Skip to content
Snippets Groups Projects
Commit 4fad7181 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau
Browse files

Add test for defsystem-depends-on incrementality

parent dea282e9
No related branches found
No related tags found
No related merge requests found
......@@ -83,3 +83,19 @@
;; so that we can check that forcing causes one file to be reloaded but not the other.
:depends-on (:file3-only)
:components ((:file "file1")))
;; These are used by test-defsystem-depends-on-change.asd, test-defsystem-depends-on-change.script
(defvar *ta/dcc* 0)
(defsystem "test-asdf/dep-can-change"
:depends-on ("test-asdf-location-change")
:perform (load-op (o c) (incf *ta/dcc*)))
(defvar *ta/dcd* 0)
(defsystem "test-asdf/dep-can-disappear"
:depends-on ("test-asdf-location-change")
:perform (load-op (o c) (incf *ta/dcd*)))
(defvar *ta/dca* 0)
(defsystem "test-asdf/dep-can-appear"
:depends-on ("test-asdf-location-change")
:perform (load-op (o c) (incf *ta/dca*)))
(defvar *tddoc* 0)
(incf *tddoc*)
(if (= *tddoc* 1)
(defsystem "test-defsystem-depends-on-change"
:defsystem-depends-on ("test-asdf/dep-can-change" "test-asdf/dep-can-disappear"))
(defsystem "test-defsystem-depends-on-change"
:defsystem-depends-on ("test-asdf/dep-can-change" "test-asdf/dep-can-appear")))
;;; -*- 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")
(DBG "Load the system, using xach-foo-1")
(push (subpathname *test-directory* "xach-foo-1/") *central-registry*)
(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))
(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))
(DBG "Now, change a defsystem-depends-on dependency and try again")
(setf (first *central-registry*) (subpathname *test-directory* "xach-foo-2/"))
(load-system "test-defsystem-depends-on-change")
(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))
;;; -*- Lisp -*-
(setf asdf/session:*asdf-session* nil) ;; disable cache between those two very different compilations.
#-(and ecl ecl-bytecmp)
(setf asdf::*load-system-operation* 'load-bundle-op) ;; This triggers a bug on ECL no more!
(defparameter foo :test-asdf-location-change)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment