test-sysdef-asdf.script 1.52 KB
Newer Older
1
;;; -*- Lisp -*-
2

3
;; Empty configuration: no asdf.asd
4
5
6
(initialize-source-registry
 '(:source-registry :ignore-inherited-configuration))
(load-system :asdf)
7
8
;; We didn't find it and got the fallback
(assert-equal nil (system-source-file (find-system :asdf)))
9

10
;; Proper configuration: asdf.asd from the source above
11
(initialize-source-registry
12
13
 `(:source-registry
   (:directory ,*asdf-directory*)
14
   (:directory ,*uiop-directory*)
15
   :ignore-inherited-configuration))
16
(load-system :asdf)
17
18
19
;; This time we found it
(assert-pathname-equal (subpathname *asdf-directory* "asdf.asd")
                       (system-source-file (find-system :asdf)))
20
21
22

(defun system-lisp-files (system)
  (loop :for f :in (required-components system :keep-component 'cl-source-file)
23
        :collect (namestring (enough-pathname (component-pathname f) *asdf-directory*))))
24
25
26

(defun makefile-lisp-files (target)
  (remove-if 'emptyp
27
             (split-string ;; NB: assumes GNU make
28
29
30
31
32
33
34
35
36
37
38
39
              (run-program `("make" "--quiet" "--no-print-directory" ,target)
                           :output :string :error-output t :directory *asdf-directory*)
              :separator #(#\space #\newline #\return #\tab))))

(defmacro compare-files (system target)
  `(assert-equal (system-lisp-files ,system) (makefile-lisp-files ,target)))

(DBG "Testing that the Makefile and ASDF agree on the order of UIOP files")
(compare-files :uiop "driver-files")

(DBG "Testing that the Makefile and ASDF agree on the order of ASDF/DEFSYSTEM files")
(compare-files :asdf/defsystem "defsystem-files")