X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-init.lisp;h=db217ecae06e1bffe78612affded35020a90e5d9;hb=fa32c4233b4a02ae631602dbb0a234ab10df8aaf;hp=005c247f803c47bf1b1d471eb2890427221728af;hpb=e5744a78271044484b3399d4fc1d55b3e8808784;p=clsql.git diff --git a/tests/test-init.lisp b/tests/test-init.lisp index 005c247..db217ec 100644 --- a/tests/test-init.lisp +++ b/tests/test-init.lisp @@ -4,28 +4,11 @@ ;;;; Authors: Marcus Pearce , Kevin Rosenberg ;;;; Created: 30/03/2004 ;;;; Updated: $Id$ -;;;; ====================================================================== -;;;; -;;;; Description ========================================================== -;;;; ====================================================================== ;;;; ;;;; Initialisation utilities for running regression tests on CLSQL. ;;;; ;;;; ====================================================================== -;;; This test suite looks for a configuration file named ".clsql-test.config" -;;; located in the users home directory. -;;; -;;; This file contains a single a-list that specifies the connection -;;; specs for each database type to be tested. For example, to test all -;;; platforms, a sample "test.config" may look like: -;;; -;;; ((:mysql ("localhost" "a-mysql-db" "user1" "secret")) -;;; (:aodbc ("my-dsn" "a-user" "pass")) -;;; (:postgresql ("localhost" "another-db" "user2" "dont-tell")) -;;; (:postgresql-socket ("pg-server" "a-db-name" "user" "secret-password")) -;;; (:sqlite ("path-to-sqlite-db"))) - (in-package #:clsql-tests) (defvar *rt-connection*) @@ -311,23 +294,38 @@ (unless specs (warn "Not running tests because test configuration file is missing") (return-from run-tests :skipped)) + (load-necessary-systems specs) (dolist (db-type +all-db-types+) (let ((spec (db-type-spec db-type specs))) (when spec - (format t -"~& + (do-tests-for-backend spec db-type)))))) + +(defun load-necessary-systems (specs) + (dolist (db-type +all-db-types+) + (when (db-type-spec db-type specs) + (db-type-ensure-system db-type)))) + +(defun do-tests-for-backend (spec db-type) + (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)))))) + (regression-test:rem-all-tests) + + ;; Tests of clsql-base + (ignore-errors (destroy-database spec :database-type db-type)) + (ignore-errors (create-database spec :database-type db-type)) + (with-tests (:name "CLSQL") + (test-basic spec db-type)) + + (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))