Commit 37801377 authored by Robert Goldman's avatar Robert Goldman
Browse files

Add test for :if-feature propagation.

The concern here is that ASDF has no way to detect that a feature has
changed and recompile files accordingly, potentially leaving users
with stale FASL files.
parent 8ac5bd42
Loading
Loading
Loading
Loading
+13 −0
Changes for test/test-package-exists.lisp: 13 added lines, 0 removed lines.
Original line number Diff line number Diff line
(defpackage :test-package-2 (:use cl))
(in-package :test-package-2)

(defmacro package-dependent-code ()
  (if (find-package :test-package)
      '(progn
        (import (intern (symbol-name '#:*file1*) :test-package)
                :test-package-2)
        (assert (asdf-test:asymval '#:*file1* :test-package-2)))
      '(assert (not (uiop:find-symbol* '#:*file1* :test-package-2
                                      nil)))))

(package-dependent-code)
+23 −0
Changes for test/test-serial-dependencies.script: 23 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -12,3 +12,26 @@
(asdf:operate 'asdf:load-op
              (asdf:find-component (asdf:find-system "test-serial-dependencies")
                                   (list "file2")))

(def-test-system "test-feature-tracking"
  :serial t
  :components
  ((:file "file1" :if-feature :changing-feature)
   (:file "test-package-exists")))

(asdf:load-system "test-feature-tracking")
;; attempt to restore to original state
(delete-package :test-package-2)
(push :changing-feature *features*)
(asdf:load-system "test-feature-tracking" :force t)

;;; if ASDF is not smart about features, then this test will fail
;;; because ASDF will load only test-package-exists
(delete-package :test-package)
(delete-package :test-package-2)
(setf *features* (remove :changing-feature *features*))
(DBG "Here we should load only test-package-exists.")
;; if ASDF correctly recompiles test-package-exists, because it
;; detects that it needs recompilation because of the feature change,
;; this test will pass.
(asdf:load-system "test-feature-tracking")