From 4fad7181aeb74aeb13b7caba25d45d31e7dfef1d Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau <fare@tunes.org> Date: Tue, 15 Nov 2016 18:42:54 -0500 Subject: [PATCH] Add test for defsystem-depends-on incrementality --- test/test-asdf.asd | 16 ++++++ test/test-defsystem-depends-on-change.asd | 8 +++ test/test-defsystem-depends-on-change.script | 55 ++++++++++++++++++++ test/test-xach-update-bug.script | 2 - 4 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 test/test-defsystem-depends-on-change.asd create mode 100644 test/test-defsystem-depends-on-change.script diff --git a/test/test-asdf.asd b/test/test-asdf.asd index 3f1ed8402..ef2ff4aa5 100644 --- a/test/test-asdf.asd +++ b/test/test-asdf.asd @@ -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*))) diff --git a/test/test-defsystem-depends-on-change.asd b/test/test-defsystem-depends-on-change.asd new file mode 100644 index 000000000..3c17719c0 --- /dev/null +++ b/test/test-defsystem-depends-on-change.asd @@ -0,0 +1,8 @@ +(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"))) diff --git a/test/test-defsystem-depends-on-change.script b/test/test-defsystem-depends-on-change.script new file mode 100644 index 000000000..1cd72686d --- /dev/null +++ b/test/test-defsystem-depends-on-change.script @@ -0,0 +1,55 @@ +;;; -*- 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)) diff --git a/test/test-xach-update-bug.script b/test/test-xach-update-bug.script index c0ddfa6ec..bb047d4be 100644 --- a/test/test-xach-update-bug.script +++ b/test/test-xach-update-bug.script @@ -1,8 +1,6 @@ ;;; -*- 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) -- GitLab