test-defsystem-depends-on-phase-overlap.script 2.03 KB
Newer Older
1 2 3 4
;;-*- Lisp -*-

(in-package :asdf-test)

5
(setf *central-registry* (list (subpathname *test-directory* "defsystem-depends-on/")))
6

7 8 9 10 11 12 13
(defvar *od* 0)
(defvar *dd* 0)
(defvar *id* 0)
(defvar *ms* 0)
(defun reset-vars (&optional (x 0))
  (setf *od* x *dd* x *id* x *ms* x))
(assert-equal (list *od* *dd* *id* *ms*) '(0 0 0 0))
14

15 16 17 18
(DBG "Finding main-system doesn't load defsystem-dependency")
(reset-vars)
(find-system "main-system")
(assert-equal (list *od* *dd* *id* *ms*) '(0 0 0 0))
19

20 21 22 23
(DBG "Finding intermediate-dependency does load defsystem-dependency")
(reset-vars)
(find-system "intermediate-dependency")
(assert-equal (list *od* *dd* *id* *ms*) '(1 1 0 0))
24

25 26 27 28
(DBG "Loading main-system doesn't reload defsystem-dependency or overlapping-dependency")
(reset-vars)
(load-system "main-system")
(assert-equal (list *od* *dd* *id* *ms*) '(0 0 1 1))
29

30 31
(DBG "Loading main-system a second time doesn't reload anything")
(reset-vars)
32
(load-system "main-system")
33 34 35 36 37 38 39 40 41 42 43 44
(assert-equal (list *od* *dd* *id* *ms*) '(0 0 0 0))

(DBG :foo
     (component-sideway-dependencies (find-system "intermediate-dependency"))
     (asdf::direct-dependencies 'prepare-op "intermediate-dependency")
     (asdf::direct-dependencies 'load-op "intermediate-dependency")
     (asdf::direct-dependencies 'compile-op "intermediate-dependency"))

(DBG "Forcing overlapping-dependency causes a complete reload, but overlapping-dependency is only loaded once")
(reset-vars)
(with-asdf-session (:override t)
  (load-system "main-system" :force '("overlapping-dependency")))
45
(assert-equal (list *od* *dd* *id* *ms*) '(1 1 1 1))
46 47 48 49 50 51 52

(DBG "actions marked as needed at one level should still be planned if needed at a higher level")
(reset-vars)
(setf (find-class 'asdf::my-cl-source-file) nil)
(asdf::clear-registered-systems)
(assert-equal *dd* 0)
(with-asdf-session (:override t)
53 54 55
  ;; get this (and asdf) out of the way, for simpler traces when tracing what matters.
  (load-system "overlapping-dependency")
  ;; This is what causes an issue without phase escalation:
56 57
  (test-system "defsystem-dependency"))
(assert-equal *dd* 10)