Next: , Previous: Elephant on Windows, Up: Installation


3.10 Test Suites

Elephant has matured quite a bit over the past year or two. Hopefully, it will work out-of-the-box for you.

However, if you are using an LISP implementation different than the ones on which it is developed and maintained (see Requirements) or you have a problem that you think may be a bug, you may want to run the test suites. If you report a bug, we will ask you to run these tests and report the output. Running them when you first install the system may give you a sense of confidence and understanding that makes it worth the trouble.

There are three files that execute the tests. You should choose one as a starting point based on what backend(s) you are using. If using BerekeleyDB, use

     BerkeleyDB-tests.lisp

If using both, use both of the above and also use:

     MigrationTests.lisp

The text of this file is included here to give the casual reader an idea of how elepant test can be run in general:

     ;; If you are only using one back-end, you may prefer:
     ;; SQLDB-test.lisp or BerkeleyDB-tests.lisp
     (asdf:operate 'asdf:load-op :elephant)
     (asdf:operate 'asdf:load-op :ele-clsql)
     (asdf:operate 'asdf:load-op :ele-bdb)
     (asdf:operate 'asdf:load-op :ele-sqlite3)
     
     (asdf:operate 'asdf:load-op :elephant-tests)
     
     (in-package "ELEPHANT-TESTS")
     
     ;; Test Postgres backend
     (setq *default-spec* *testpg-spec*)
     (do-backend-tests)
     
     ;; Test BDB backend
     (setq *default-spec* *testbdb-spec*)
     (do-backend-tests)
     
     ;; Test SQLite 3
     (setq *default-spec* *testsqlite3-spec*)
     (do-backend-tests)
     
     ;; Test a Migration of data from BDB to postgres
     (do-migration-tests *testbdb-spec* *testpg-spec*)
     
     ;; An example usage.
     (open-store *testpg-spec*)
     (add-to-root "x1" "y1")
     (get-from-root "x1")
     
     (add-to-root "x2" '(a 4 "spud"))
     (get-from-root "x2")

The appropriate test should execute for you with no errors. If you get errors, you may wish to report it the elephant-devel at common-lisp.net email list.

Setting up SQLite3 is even easier. Install SQLite3 (I had to use the source rather than the binary install, in order to get the dynamic libraries constructed.)

An example use of SQLLite3 would be:

     (asdf:operate 'asdf:load-op :elephant)
     (asdf:operate 'asdf:load-op :ele-clsql)
     (asdf:operate 'asdf:load-op :ele-sqlite3)
     (in-package "ELEPHANT-TESTS")
     (setq *test-path-primary* '(:sqlite3 "testdb"))
     (do-all-tests-spec *test-path-primary*)

The file RUNTESTS.lisp, although possibly not exactly what you want, contains useful example code.

You can of course migrate between the three currently supported repository strategies in any combination: BDB, Postgresql, and SQLite3.

In all probability, other relational datbases would be very easy to support but have not yet been tested. The basic pattern of the “path” specifiers is (cons clsqal-database-type-symbol (normal-clsql-connection-specifier)).