X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=tests%2Ftest-init.lisp;h=005c247f803c47bf1b1d471eb2890427221728af;hb=e5744a78271044484b3399d4fc1d55b3e8808784;hp=80bd6b323760a401d14150b3a6daf5f2fc57a07f;hpb=70227e5f0b76bb649fc6c1a478d7374953fd815b;p=clsql.git diff --git a/tests/test-init.lisp b/tests/test-init.lisp index 80bd6b3..005c247 100644 --- a/tests/test-init.lisp +++ b/tests/test-init.lisp @@ -28,11 +28,6 @@ (in-package #:clsql-tests) -(defvar *config-pathname* - (make-pathname :defaults (user-homedir-pathname) - :name ".clsql-test" - :type "config")) - (defvar *rt-connection*) (defvar *rt-fddl*) (defvar *rt-fdml*) @@ -311,51 +306,28 @@ (clsql:update-records-from-instance employee10) (clsql:update-records-from-instance company1)) -(defclass conn-specs () - ((aodbc-spec :accessor aodbc :initform nil) - (mysql-spec :accessor mysql :initform nil) - (pgsql-spec :accessor postgresql :initform nil) - (pgsql-socket-spec :accessor postgresql-socket :initform nil) - (sqlite-spec :accessor sqlite :initform nil)) - (:documentation "Connection specifications for CLSQL testing")) - (defun run-tests () (let ((specs (read-specs))) (unless specs (warn "Not running tests because test configuration file is missing") (return-from run-tests :skipped)) - (dolist (accessor '(postgresql postgresql-socket sqlite aodbc mysql)) - (unless (find-package (symbol-name accessor)) - (asdf:operate 'asdf:load-op - (intern (concatenate 'string - (symbol-name '#:clsql-) - (symbol-name accessor))))) - (rt:rem-all-tests) - (dolist (test (append *rt-connection* *rt-fddl* *rt-fdml* - *rt-ooddl* *rt-oodml* *rt-syntax*)) - (eval test)) - - (let ((spec (funcall accessor specs)) - (backend (intern (symbol-name accessor) (find-package :keyword)))) + (dolist (db-type +all-db-types+) + (let ((spec (db-type-spec db-type specs))) (when spec - (format t "~&Running CLSQL tests with ~A backend.~%" backend) - (test-connect-to-database backend spec) + (format t +"~& +******************************************************************* +*** Running CLSQL tests with ~A backend. +******************************************************************* +" db-type) + (db-type-ensure-system db-type) + (regression-test:rem-all-tests) + (ignore-errors (destroy-database spec :database-type db-type)) + (ignore-errors (create-database spec :database-type db-type)) + (dolist (test (append *rt-connection* *rt-fddl* *rt-fdml* + *rt-ooddl* *rt-oodml* *rt-syntax*)) + (eval test)) + (test-connect-to-database db-type spec) (test-initialise-database) (rtest:do-tests)))))) -(defun read-specs (&optional (path *config-pathname*)) - (if (probe-file path) - (with-open-file (stream path :direction :input) - (let ((config (read stream)) - (specs (make-instance 'conn-specs))) - (setf (aodbc specs) (cadr (assoc :aodbc config))) - (setf (mysql specs) (cadr (assoc :mysql config))) - (setf (postgresql specs) (cadr (assoc :postgresql config))) - (setf (postgresql-socket specs) - (cadr (assoc :postgresql-socket config))) - (setf (sqlite specs) (cadr (assoc :sqlite config))) - specs)) - (progn - (warn "CLSQL tester config file ~S not found" path) - nil))) -