Added testing of quicklisp libraries

This commit is contained in:
Juan Jose Garcia Ripoll 2011-12-07 23:59:53 +01:00
parent 528f7fb7dd
commit 460287c948
2 changed files with 111 additions and 6 deletions

View file

@ -2,7 +2,7 @@ ECL=ecl
all: output.ecl/ansi.log output.ecl/regressions.log
.PHONY: do-ansi do-regressions cleanup clean-sources update
.PHONY: do-ansi do-regressions do-quicklisp cleanup clean-sources update
output.ecl/ansi.log: config.lsp
$(MAKE) do-ansi
@ -13,6 +13,8 @@ do-ansi: ansi-tests
$(ECL) -norc -load config.lsp -eval '(ecl-tests::run-ansi-tests)' -eval '(ext:quit)' < /dev/null
do-regressions: regressions
$(ECL) -norc -load config.lsp -eval '(ecl-tests::run-regressions-tests)' -eval '(ext:quit)' < /dev/null
do-quicklisp: quicklisp
$(ECL) -norc -load config.lsp -eval '(ecl-tests::run-quicklisp-tests)' -eval '(ext:quit)' < /dev/null
#
# Create directories
@ -21,6 +23,8 @@ ansi-tests:
$(ECL) -norc -load config.lsp -eval '(ecl-tests::ensure-ansi-tests)' -eval '(ext:quit)' < /dev/null
regressions:
$(ECL) -norc -load config.lsp -eval '(ecl-tests::ensure-regressions)' -eval '(ext:quit)' < /dev/null
quicklisp:
$(ECL) -norc -load config.lsp -eval '(ecl-tests::ensure-quicklisp)' -eval '(ext:quit)' < /dev/null
#
# Test other implementations
@ -43,4 +47,5 @@ clean-sources:
distclean: clean-sources clean
update: clean-sources
$(MAKE) ansi-tests regressions
$(MAKE) ansi-tests regressions quicklisp

View file

@ -18,8 +18,15 @@
(defvar *here* (merge-pathnames "@builddir@/"))
(defvar *test-image* (or (ext:getenv "TEST_IMAGE")
(namestring (merge-pathnames "../bin/ecl" *here*))))
(defvar *test-image* (or (ext:getenv "TEST_IMAGE") "ecl"))
(defvar *test-image-args*
(cond ((search "ecl" *test-image*)
'("-norc"))
((search "sbcl" *test-image*)
'("--no-userinit" "--no-sysinit"))
(t
'())))
(defvar *test-name* (or (ext:getenv "TEST_NAME") "ecl"))
@ -195,7 +202,7 @@
(progn
(ext:chdir *ansi-tests-sandbox*)
(ext:run-program *test-image*
'()
*test-image-args*
:input (merge-pathnames "doit.lsp" *ansi-tests-sandbox*)
:output output
:error :output))
@ -212,9 +219,102 @@
(progn
(ext:chdir *regressions-sandbox*)
(ext:run-program *test-image*
'()
*test-image-args*
:input (merge-pathnames "doit.lsp" *regressions-sandbox*)
:output output
:error :output))
(ext:chdir *here*)))
(defvar *quicklisp-library-list*
'(trivial-features
alexandria
babel
cffi
cl-ppcre
cl-unicode
iterate
trivial-gray-streams
trivial-garbage
flexi-streams
lift
metabang-bind
swank
stefil
sqlite
chunga
cl+ssl
cl-base64
cl-fad
cl-python
md5
rfc2388
trivial-backtrace
trivial-gray-streams
usocket
hunchentoot))
(defconstant +quicklisp-build-template+ "
(require 'asdf)
(setf (symbol-value (read-from-string \"asdf::*user-cache*\"))
(list ~s :implementation))
(load ~s)
(ql:use-only-quicklisp-systems)
(handler-case
(progn
(ql:quickload ~s)
(princ \"ECL-BUILD-OK\"))
(serious-condition (c) (princ c)))
(si::quit)
")
(defconstant +quicklisp-test-template+ "
(require 'asdf)
(setf (symbol-value (read-from-string \"asdf::*user-cache*\"))
(list ~s :implementation))
(load ~s)
(ql:use-only-quicklisp-systems)
(handler-case
(progn
(ql:quickload ~s)
(princ \"ECL-BUILD-OK\")
(asdf:oos 'asdf:test-op :$name)
(princ \"ECL-TEST-OK\"))
(serious-condition (c) (princ c)))
")
(defun run-quicklisp-tests (&optional (output (merge-pathnames "quicklisp.log"
*output-directory*)))
(mapcar #'delete-everything (directory (merge-pathnames "*/" *cache*)))
(let ((quicklisp-logs (merge-pathnames "quicklisp.logs/" *output-directory*)))
(labels ((build-or-test-job (name suffix template)
(let* ((name (string-downcase name))
(log-name (concatenate 'string name suffix))
(build-log (ensure-directories-exist
(merge-pathnames log-name quicklisp-logs))))
(multiple-value-bind (stream status process)
(ext:run-program *test-image*
*test-image-args*
:input :stream
:output build-log
:error :output
:wait nil)
(unwind-protect
(progn
(format stream template
(namestring *cache*)
(namestring *quicklisp-setup-file*)
name)
(format t template
(namestring *cache*)
(namestring *quicklisp-setup-file*)
name)
(force-output stream))
(close stream)
(ext:external-process-wait process t)
))))
(build-job (name)
(build-or-test-job name "-build.log" +quicklisp-build-template+))
(test-job (name)
(build-or-test-job name "-test.log" +quicklisp-test-template+)))
(mapc #'build-job *quicklisp-library-list*)
(mapc #'test-job *quicklisp-library-list*))))