test-basic.lisp 3.29 KB
Newer Older
1 2 3
(in-package :asdf-tools)

(deftestcmd %load (lisp) ;; load would be a clash, so use %load instead
4 5 6
  "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."
7 8 9 10 11 12 13 14
  (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)))

15 16 17 18 19 20 21 22 23 24 25 26
(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.~%")))

27
(deftestcmd test-load-systems (lisp systems)
28 29
  "test loading of your favorite systems
Use your preferred Lisp implementation"
30 31 32 33 34 35 36 37 38
  (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)))))
39 40

(deftestcmd test-clean-load (lisp log)
41 42
  "test that asdf load cleanly
Use your preferred lisp implementation and check that asdf is loaded without any output message"
43 44 45 46 47 48 49
  (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
50
      (format nil "starting ~(~A~), loading the script support, and exiting without doing anything" lisp)
51 52 53 54
      `((load "test/script-support.lisp" :verbose nil :print nil)
        (asdf-test::exit-lisp 0))
      :lisp lisp :output nop :log log)
     (run-test-lisp
55
      (format nil "starting ~(~A~), loading the script support, loading ASDF from source, then exiting" lisp)
56
      `((load "test/script-support.lisp" :verbose nil :print nil)
57
        (asdf-test::verbose nil)
58
        (load "build/asdf.lisp" :verbose nil :print nil)
59
        (uiop/image:quit 0))
60 61 62 63 64
      :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)
65
           (return (success)))
66 67 68 69 70
         (progn
           (log! log "BAD: Loading ASDF on ~(~A~) produces messages" lisp)
           (return nil))))))

(deftestcmd test-basic (lisp systems)
71
  "basic test: doc, clean-load, load-systems"
72
  (without-stopping ()
73
    (show-version)
74
    (doc)
75
    (test-ascii)
76 77
    (test-clean-load lisp)
    (test-load-systems lisp systems)))
78 79 80 81 82 83

(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))))
84 85 86 87

(deftestcmd show-version ()
  (format t "Building and testing asdf ~A~%" (version-from-tag)))