-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-basic.lisp
87 lines (78 loc) · 3.33 KB
/
test-basic.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
(in-package :asdf-tools)
(deftestcmd %load (lisp) ;; load would be a clash, so use %load instead
"load asdf into an interactive Lisp for debugging
load from individual source files, to make it easier to quickly locate
compilation errors and to interactively debug ASDF."
(with-asdf-dir ()
(run-test-lisp
(format nil "loading ASDF into an interactive ~(~A~)" lisp)
`((load "test/script-support.lisp")
(asdf-test::interactive-test
',(system-source-files :asdf/defsystem :monolithic t)))
:lisp lisp :debugger t :output :interactive)))
(defmacro with-systems-test ((systems) &body body)
`(call-with-systems-test ,systems (lambda () ,@body)))
(defun call-with-systems-test (systems thunk)
(if systems
(funcall thunk)
(format t "Skipping system loading test.
To enable the system loading test,
export ASDF_TEST_SYSTEMS=\"some systems\"
or pass s=\"some systems\" to your make command
and this test with make sure those systems can be loaded.~%")))
(deftestcmd test-load-systems (lisp systems)
"test loading of your favorite systems
Use your preferred Lisp implementation"
(with-systems-test (systems)
(with-asdf-dir ()
(let* ((log (newlogfile "systems" lisp)))
(log! log "Loading all these systems on ~(~A~):~{~% ~A~}~%~%" lisp systems)
(run-test-lisp
"loading the systems"
`((load "test/script-support.lisp")
(asdf-test::with-test () (asdf-test::test-load-systems ,@systems)))
:lisp lisp :log log)))))
(deftestcmd test-clean-load (lisp log)
"test that asdf load cleanly
Use your preferred lisp implementation and check that asdf is loaded without any output message"
(nest
(block ()
(case lisp ((:gcl :cmucl) (return t)))) ;; These are hopeless
(with-asdf-dir ())
(let ((nop (newlogfile "nop" lisp))
(load (newlogfile "load" lisp)))
(run-test-lisp
(format nil "starting ~(~A~), loading the script support, and exiting without doing anything" lisp)
`((load "test/script-support.lisp" :verbose nil :print nil)
(asdf-test::exit-lisp 0))
:lisp lisp :output nop :log log)
(run-test-lisp
(format nil "starting ~(~A~), loading the script support, loading ASDF from source, then exiting" lisp)
`((load "test/script-support.lisp" :verbose nil :print nil)
(asdf-test::verbose nil)
(load "build/asdf.lisp" :verbose nil :print nil)
(uiop/image:quit 0))
:lisp lisp :output load :log log)
(if (nth-value 2 (run `(diff ,nop ,load)
:output :interactive :error-output :output :input nil))
(progn
(log! log "GOOD: Loading ASDF on ~(~A~) produces no message" lisp)
(return (success)))
(progn
(log! log "BAD: Loading ASDF on ~(~A~) produces messages" lisp)
(return nil))))))
(deftestcmd test-basic (lisp systems)
"basic test: doc, clean-load, load-systems"
(without-stopping ()
(show-version)
;; (doc) ;; Let's test doc separately
(test-ascii)
(test-clean-load lisp)
(test-load-systems lisp systems)))
(deftestcmd test-ascii ()
"test that asdf is all ASCII"
(success-if
(loop for c across (read-file-string (pn "build/asdf.lisp"))
always (<= 0 (char-code c) 127))))
(deftestcmd show-version ()
(format t "Building and testing asdf ~A~%" (version-from-tag)))