diff --git a/test/test-missing-lisp-file.asd b/test/test-missing-lisp-file.asd new file mode 100644 index 0000000000000000000000000000000000000000..5c32bb8f7196b33526f118cf619b8c7bd5be3567 --- /dev/null +++ b/test/test-missing-lisp-file.asd @@ -0,0 +1,5 @@ +;;; -*- Lisp -*- +(asdf:defsystem test-missing-lisp-file + :components ((:file "file2" :in-order-to ((compile-op (load-op "fileMissing")))) + (:file "fileMissing"))) + diff --git a/test/test-missing-lisp-file.script b/test/test-missing-lisp-file.script new file mode 100644 index 0000000000000000000000000000000000000000..acb4580cd71e263c4cf3222d8b16d4e86144a50f --- /dev/null +++ b/test/test-missing-lisp-file.script @@ -0,0 +1,49 @@ +;;; -*- Lisp -*- + +;;;--------------------------------------------------------------------------- +;;; This is supposed to verify that if a lisp file is lost, then any attempt to +;;; make the system will fail. I.e., we verify that we won't just load a stale +;;; fasl when the source file is lost. +;;;--------------------------------------------------------------------------- + +(load "script-support") +(load-asdf) + +(quit-on-error + (setf asdf:*central-registry* '(*default-pathname-defaults*)) + (let ((missing-name (namestring + (make-pathname :name "fileMissing" + :type "lisp" + :defaults + *default-pathname-defaults*))) + (template-file (namestring + (make-pathname :name "file1" + :type "lisp" + :defaults + *default-pathname-defaults*)))) + (asdf::run-shell-command + (format nil "cp ~a ~a" template-file missing-name)) + (unless (probe-file missing-name) + (format t "File copy failed.~%")) + (asdf:operate 'asdf:load-op 'test-missing-lisp-file) + ;; test that it compiled + (let* ((file1 (asdf:compile-file-pathname* "file2")) + (file2 (asdf:compile-file-pathname* "fileMissing")) + (file1-date (file-write-date file1))) + + (assert file1-date) + (assert (file-write-date file2)) + + ;; and loaded + (assert (symbol-value (find-symbol (symbol-name :*file1*) :test-package))) + + ;; now remove the lisp file we created, and wait for an error + (sleep 1) ; mtime has 1-second granularity, so pause here for fast machines + + (asdf::run-shell-command (format nil "rm -f ~A" missing-name)) + ;; we shouldn't be able to find the input-file for the compile-op, and that + ;; should be an error. + (multiple-value-bind (retval err) + (ignore-errors + (asdf:operate 'asdf:load-op 'test-missing-lisp-file)) + (assert err)))))