test-defsystem-depends-on-phase-overlap.script 2.36 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
(defvar *od* 0)
(defvar *dd* 0)
(defvar *id* 0)
(defvar *ms* 0)
11 12
(defvar *cod* 0)
(defvar *cdd* 0)
13
(defun reset-vars (&optional (x 0))
14 15
  (setf *od* x *dd* x *id* x *ms* x *cod* x *cdd* x))
(assert-equal (list *od* *dd* *id* *ms* *cod* *cdd*) '(0 0 0 0 0 0))
16

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

22 23 24 25
(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))
26

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

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

(DBG "Loading main-system in a different session loads but doesn't recompile")
(reset-vars)
(asdf::clear-registered-systems)
(load-system "main-system")
(assert-equal (list *od* *dd* *id* *ms* *cod* *cdd*) '(1 1 1 1 0 0))
42 43 44 45 46 47 48 49 50 51 52

(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")))
53
(assert-equal (list *od* *dd* *id* *ms*) '(1 1 1 1))
54 55 56 57 58 59 60

(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)
61 62 63
  ;; 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:
64 65
  (test-system "defsystem-dependency"))
(assert-equal *dd* 10)
66