Testing Lisp
Gary King wrote an article not so recently about how to set up ASDF test-ops. I basically stole it, but have changed it a bit to work more intuitively (IMO). He arrives at the following test system definition:
1 2 3 4 5 6 7 8 9 10 11 12 13 | (defsystem moptilities-test :components ((:module "test" :components ((:file "tests")))) :in-order-to ((test-op (load-op moptilities-test))) :perform (test-op :after (op c) (describe (funcall (intern "RUN-TESTS" "LIFT") :suite (intern "TEST-MOPTILITIES" "TEST-MOPTILITIES")))) :depends-on (moptilities lift)) (defmethod operation-done-p ((o test-op) (c (eql (find-system 'moptilities-test)))) (values nil)) |
However, it seems to me that (asdf:oos 'asdf:test-op :moptilities-test) should be testing the tests, not Moptilities. I would much prefer to see (asdf:oos 'asdf:test-op :moptilities), and this is possible with a little rearrangement.
You still need a test system, but it should be pretty minimal:
1 2 3 4 | (defsystem moptilities-test :components ((:module "test" :components ((:file "tests")))) :depends-on (moptilities lift)) |
Then, the other pieces should be in the primary system:
1 2 3 4 5 6 7 8 | (defsystem moptilities :components (...) :in-order-to ((test-op (load-op moptilities-test))) :perform (test-op :after (op c) (describe (funcall (intern "RUN-TESTS" :lift) :suite (intern "TEST-MOPTILITIES" :moptilities-test)))) :depends-on (...)) |
Yeah, in addition to moving things to the primary system, I also changed a couple strings to keywords … just a personal preference. Also, OPERATION-DONE-P should operate on the MOPTILITIES system, rather than MOPTILITIES-TEST. Oh, and I changed the package name from TEST-MOPTILITIES to MOPTILITIES-TEST. I?like to keep packages as nouns and functions as verbs.
I’m always searching through Gary’s archives to find this, and then re-remembering my variations, so this puts it all in one place for me (and maybe others) in the future. Leave a comment if you have any suggestions.

April 4th, 2006 at 19:29
Off-topic:
Got you the link to the shootout benchmarks: http://shootout.alioth.debian.org/gp4/index.php
It’s SBCL, but the cmucl faq says that the application speeds should be similar. Anyway, things don’t look so bright.
July 26th, 2006 at 21:33
Hi,
I found your blog entry very useful. Thank you !
I also have one question:
Why do you use that describe? The result I obtain when applying this is:
NIL is an external symbol in #<package “COMMON-LISP”>. It is a constant; its value is NIL. NIL