tests: simplify make target

This commit is contained in:
Daniel Kochmański 2016-08-07 17:19:01 +02:00
parent 36a06c74e9
commit f72077549c
3 changed files with 31 additions and 61 deletions

View file

@ -3,40 +3,15 @@
ECL=@prefix@/@bindir@/ecl@EXEEXT@
all: show-fails
.PHONY: all
.PHONY: do-regressions cleanup clean-sources update
all: check
BUGS_FILES := $(shell find ../../src/tests/regressions/ -type f)
check: config.lsp
$(ECL) -norc -load config.lsp \
-eval '(ecl-tests::run-regressions-tests)' \
-eval '(ext:quit)' \
2>&1 | tee check.log
regressions.log: config.lsp
$(MAKE) do-regressions
do-regressions: regressions config.lsp
$(ECL) -norc -load config.lsp -eval '(ecl-tests::run-regressions-tests)' -eval '(ext:quit)' 2>&1 | tee regressions.log
show-fails: regressions.log
tail -n 16 regressions.log
#
# Create directories
#
regressions: config.lsp $(BUGS_FILES)
$(ECL) -norc -load config.lsp -eval '(ecl-tests::ensure-regressions)' -eval '(ext:quit)' < /dev/null
#
# Cleanup
#
clean:
rm -rf regressions.log
clean-sources:
test -f config.lsp.in || rm -rf bugs
rm -rf regressions
distclean: clean-sources clean
rm -rf cache
update: clean-sources
$(MAKE) regressions
rm -rf regressions.log cache

View file

@ -3,6 +3,7 @@
;;;
;;; (c) 2011, Juan Jose Garcia-Ripoll
;;; (c) 2016, Daniel Kochmański
;;;
;;; Set up the test environment.
;;;
@ -23,32 +24,26 @@
(defvar *test-sources* (merge-pathnames "tests/" *ecl-sources*))
(defvar *here* (merge-pathnames "@builddir@/"))
(defvar *cache* (merge-pathnames "./cache/" *here*))
(defvar *test-image* (or (ext:getenv "TEST_IMAGE")
#+windows
(namestring (truename #+windows "sys:ecl.exe"))
#-windows
"@prefix@/bin/ecl"))
(defvar *test-image*
(or (ext:getenv "TEST_IMAGE")
#+windows (namestring (truename "sys:ecl.exe"))
#-windows "@prefix@/bin/ecl"))
(defvar *test-image-args*
(cond ((search "ecl" *test-image*)
'("-norc" "-eval" "(print (ext:getenv \"ECLDIR\"))"
;#+windows "-eval" #+windows "(require :cmp)"
))
((search "sbcl" *test-image*)
'("--no-userinit" "--no-sysinit"))
(t
'())))
`("-norc"
"-eval" "(print (ext:getenv \"ECLDIR\"))"
"-eval" "(ignore-errors (require :cmp))"
"-load" ,(namestring (merge-pathnames "doit.lsp" *test-sources*))
"-eval" "(quit)"))
#+ecl
(ext:setenv "ECLDIR" (namestring (truename "SYS:")))
(defvar *test-name* (or (ext:getenv "TEST_NAME") "ecl"))
(defvar *output-directory* *here*)
(defvar *regressions-sources* (merge-pathnames "regressions/" *test-sources*))
(defvar *regressions-sandbox* (merge-pathnames "regressions/" *here*))
(defvar *regressions-sources* *test-sources*)
(defvar *regressions-sandbox* *here*)
(defvar *wild-inferiors* (make-pathname :name :wild
:type :wild
:version :wild
@ -68,19 +63,10 @@
(merge-pathnames "**/*.*"
(lisp-system-directory)))))
(require :cmp)
;;;
;;; PREPARATION OF DIRECTORIES AND FILES
;;;
(defun setup-asdf ()
(require :asdf)
(ensure-directories-exist *cache*)
(setf (symbol-value (read-from-string "asdf::*user-cache*"))
(list *cache* :implementation)))
(defun delete-everything (path)
;; Recursively run through children
(labels ((recursive-deletion (path)
@ -116,7 +102,6 @@
(unless (probe-file *regressions-sandbox*)
(copy-directory *regressions-sources* *regressions-sandbox*)))
(defun cleanup-directory (path)
(loop for i in (directory (merge-pathnames *wild-inferiors*
path))
@ -136,7 +121,7 @@
(ext:chdir *regressions-sandbox*)
(ext:run-program *test-image*
*test-image-args*
:input (merge-pathnames "doit.lsp" *regressions-sandbox*)
:input nil ; (merge-pathnames "doit.lsp" *regressions-sources*)
:output t
:error :output))
(ext:chdir *here*)))

10
src/tests/doit.lsp Normal file
View file

@ -0,0 +1,10 @@
(eval-when (:compile-toplevel :load-toplevel :execute)
(require :asdf))
(let ((cache (merge-pathnames "./cache/" *default-pathname-defaults*)))
(ensure-directories-exist cache)
(setf asdf:*user-cache* cache)
(asdf:load-asd (merge-pathnames "ecl-tests.asd" *load-pathname*)))
(asdf:operate 'asdf:load-source-op 'ecl-tests)
(2am-ecl:run 'cl-test::regressions)