test-defsystem-depends-on-change.script 2.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
;;; -*- Lisp -*-
;; Testing proper stratification of defsystem-depends-on changes.

(DBG "Test that when a defsystem-depends-on (indirect) dependency changes, the system is recompiled, yet that dependencies of the old definition that are not dependencies of the new definition are not recompiled.")

;; disable cache between those compilations.
(setf asdf/session:*asdf-session* nil)

(defparameter tddoc "test-defsystem-depends-on-change")
(defparameter talc "test-asdf-location-change")
11
(defparameter asdf-user::*tddoc* 0)
12

13
(terpri)(terpri)
14 15
(DBG "Load the system, using xach-foo-1")
(push (subpathname *test-directory* "xach-foo-1/") *central-registry*)
16
(clear-system tddoc)
17 18 19 20 21 22 23 24 25 26 27 28 29
(load-system tddoc)
(assert-equal asdf-user::*tddoc* 1)
(assert-equal test-asdf-system::*times-loaded* 1)
(assert-equal test-asdf-system::*ta/dcc* 1)
(assert-equal test-asdf-system::*ta/dcd* 1)
(assert-equal test-asdf-system::*ta/dca* 0)
(assert-pathname-equal
 (subpathname *test-directory* "test-defsystem-depends-on-change.asd")
 (system-source-file tddoc))
(assert-pathname-equal
 (subpathname *test-directory* "xach-foo-1/test-asdf-location-change.asd")
 (system-source-file talc))

30 31

(terpri)(terpri)
32 33 34 35 36 37 38 39 40 41 42 43 44 45
(DBG "Load it again: there should be no changes")
(load-system "test-defsystem-depends-on-change")
(assert-equal asdf-user::*tddoc* 1)
(assert-equal test-asdf-system::*times-loaded* 1)
(assert-equal test-asdf-system::*ta/dcc* 1)
(assert-equal test-asdf-system::*ta/dcd* 1)
(assert-equal test-asdf-system::*ta/dca* 0)
(assert-pathname-equal
 (subpathname *test-directory* "test-defsystem-depends-on-change.asd")
 (system-source-file tddoc))
(assert-pathname-equal
 (subpathname *test-directory* "xach-foo-1/test-asdf-location-change.asd")
 (system-source-file talc))

46

47 48
(DBG "Now, change a defsystem-depends-on dependency and try again")
(setf (first *central-registry*) (subpathname *test-directory* "xach-foo-2/"))
49
(DBG :before asdf-user::*tddoc* test-asdf-system::*times-loaded* test-asdf-system::*ta/dcc* test-asdf-system::*ta/dcd* test-asdf-system::*ta/dca*)
50
(load-system "test-defsystem-depends-on-change" :force '("test-asdf/dep-forced"))
51
(DBG :after asdf-user::*tddoc* test-asdf-system::*times-loaded* test-asdf-system::*ta/dcc* test-asdf-system::*ta/dcd* test-asdf-system::*ta/dca*)
52 53 54 55 56 57 58 59 60 61 62
(assert-equal asdf-user::*tddoc* 2)
(assert-equal test-asdf-system::*times-loaded* 1) ;; from test-asdf.asd
(assert-equal test-asdf-system::*ta/dcc* 2)
(assert-equal test-asdf-system::*ta/dcd* 1)
(assert-equal test-asdf-system::*ta/dca* 1)
(assert-pathname-equal
 (subpathname *test-directory* "test-defsystem-depends-on-change.asd")
 (system-source-file tddoc))
(assert-pathname-equal
 (subpathname *test-directory* "xach-foo-2/test-asdf-location-change.asd")
 (system-source-file talc))