Commit cca259c4 authored by Francois-Rene Rideau's avatar Francois-Rene Rideau

Fix tests broken by recent touch changes.

parent 5659fed3
...@@ -43,7 +43,9 @@ ...@@ -43,7 +43,9 @@
(defsystem :test-encoding-explicit-u8 (defsystem :test-encoding-explicit-u8
:components ((:file "lambda" :encoding :utf-8)))) :components ((:file "lambda" :encoding :utf-8))))
#+(and asdf-unicode (or clozure sbcl)) ;; NB: recent clozure can autodetect without asdf-encodings with :default (!)
#+(and asdf-unicode sbcl)
(progn (progn
#+clozure (setf ccl:*default-external-format* :latin3) #+clozure (setf ccl:*default-external-format* :latin3)
#+sbcl (setf sb-impl::*default-external-format* :latin-3) #+sbcl (setf sb-impl::*default-external-format* :latin-3)
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
(assert file1-date) (assert file1-date)
;; unforced, date should stay same ;; unforced, date should stay same
(touch-file "file1.lisp" date1) (touch-file "file1.lisp" :timestamp date1)
(touch-file file1 date2) (touch-file file1 :timestamp date2)
(asdf:operate 'asdf:load-op 'test-force) (asdf:operate 'asdf:load-op 'test-force)
(assert (equal (file-write-date file1) date2)) (assert (equal (file-write-date file1) date2))
......
;;; -*- Lisp -*-
(asdf:defsystem test-missing-lisp-file
:components ((:file "file2" :in-order-to ((compile-op (load-op "fileMissing"))
(load-op (load-op "fileMissing"))))
(:file "fileMissing")))
...@@ -10,7 +10,10 @@ ...@@ -10,7 +10,10 @@
(load-asdf) (load-asdf)
(quit-on-error (quit-on-error
(setf asdf:*central-registry* '(*default-pathname-defaults*)) (asdf:defsystem test-missing-lisp-file
:components ((:file "file2" :in-order-to ((compile-op (load-op "fileMissing"))
(load-op (load-op "fileMissing"))))
(:file "fileMissing")))
(let ((missing-name (namestring (let ((missing-name (namestring
(make-pathname :name "fileMissing" (make-pathname :name "fileMissing"
:type "lisp" :type "lisp"
...@@ -21,8 +24,7 @@ ...@@ -21,8 +24,7 @@
:type "lisp" :type "lisp"
:defaults :defaults
*default-pathname-defaults*)))) *default-pathname-defaults*))))
(asdf::run-shell-command (asdf::concatenate-files (list template-file) missing-name)
(format nil "cp ~a ~a" template-file missing-name))
(unless (probe-file missing-name) (unless (probe-file missing-name)
(format t "File copy failed.~%")) (format t "File copy failed.~%"))
(asdf:operate 'asdf:load-op 'test-missing-lisp-file) (asdf:operate 'asdf:load-op 'test-missing-lisp-file)
...@@ -38,9 +40,8 @@ ...@@ -38,9 +40,8 @@
(assert (symbol-value (find-symbol (symbol-name :*file1*) :test-package))) (assert (symbol-value (find-symbol (symbol-name :*file1*) :test-package)))
;; now remove the lisp file we created, and wait for an error ;; 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)) (asdf::delete-file-if-exists missing-name)
;; we shouldn't be able to find the input-file for the compile-op, and that ;; we shouldn't be able to find the input-file for the compile-op, and that
;; should be an error. ;; should be an error.
(let ((err (nth-value 1 (ignore-errors (asdf:operate 'asdf:load-op 'test-missing-lisp-file))))) (let ((err (nth-value 1 (ignore-errors (asdf:operate 'asdf:load-op 'test-missing-lisp-file)))))
......
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
;; date should stay same ;; date should stay same
(asdf:clear-system 'static-and-serial) (asdf:clear-system 'static-and-serial)
(touch-file "file2.lisp" date1) (touch-file "file2.lisp" :timestamp date1)
(touch-file "file1.lisp" date2) (touch-file "file1.lisp" :timestamp date2)
(touch-file file1 date3) (touch-file file1 :timestamp date3)
(asdf:operate 'asdf:load-op 'static-and-serial) (asdf:operate 'asdf:load-op 'static-and-serial)
(assert (equal (file-write-date file1) date3)))) (assert (equal (file-write-date file1) date3))))
...@@ -10,17 +10,20 @@ ...@@ -10,17 +10,20 @@
(let ((data (asdf::system-registered-p name))) (let ((data (asdf::system-registered-p name)))
(when data (when data
(car data))))) (car data)))))
(setf asdf:*central-registry* '(*default-pathname-defaults*)) (let* ((file "test1.asd")
(asdf:find-system :test1) (date1 (file-write-date file))
(let ((date1 (system-load-time :test1)) (date2 (- date1 600))
(file (namestring (merge-pathnames "test1.asd")))) (date3 (- date1 300)))
(assert date1) (touch-file file :timestamp date2)
(assert file)
(sleep 1)
(touch-file file)
(asdf:find-system :test1) (asdf:find-system :test1)
(let ((date2 (system-load-time :test1))) (let ((date4 (file-write-date (asdf::compile-file-pathname* "file1.lisp")))
(print (list date1 date2)) (date5 (system-load-time :test1)))
(assert date2) (DBG :blah date2 date3 date4 date5)
(assert (> date2 date1)))))) (assert-equal date2 date5)
(assert (>= date4 date3))
(sleep 1)
(touch-file file)
(asdf:find-system :test1)
(let ((date6 (system-load-time :test1)))
(assert (> date6 date4)))))))
\ No newline at end of file
...@@ -10,24 +10,27 @@ ...@@ -10,24 +10,27 @@
(let* ((file1 (asdf:compile-file-pathname* "file1")) (let* ((file1 (asdf:compile-file-pathname* "file1"))
(file2 (asdf:compile-file-pathname* "file2")) (file2 (asdf:compile-file-pathname* "file2"))
(file1-date (file-write-date file1)) (file1-date (file-write-date file1))
(file2-date (file-write-date file2))) (file2-date (file-write-date file1)))
(DBG "test that it compiled" file1 file1-date) (DBG "test that it compiled" file1 file1-date)
(assert file1-date) (assert file1-date)
(assert file2-date) (assert file2-date)
(touch-file file1 :timestamp (- file1-date 200))
(touch-file file2 :timestamp (- file1-date 100))
(DBG "and loaded") (DBG "and loaded")
(assert (symbol-value (find-symbol (symbol-name :*file1*) :test-package))) (assert (symbol-value (find-symbol (symbol-name :*file1*) :test-package)))
(DBG "now remove file2 that depends-on file1" file1-date (- file1-date 120)) (DBG "now remove file2 that depends-on file1" file1-date (- file1-date 120))
(touch-file file1 :timestamp (- file1-date 120)) ;; move file1.fasl two minutes ago. (touch-file file1 :timestamp (- file1-date 150)) ;; move file1.fasl two minutes ago.
(assert-equal (- file1-date 120) (file-write-date file1)) (assert-equal (- file1-date 150) (file-write-date file1))
(asdf::delete-file-if-exists file2) (asdf::delete-file-if-exists file2)
(DBG "load again")
(asdf:clear-system 'test1) (asdf:clear-system 'test1)
(asdf:load-system 'test1) (asdf:load-system 'test1)
(DBG "check that file1 is _not_ recompiled, but file2 is" (file-write-date file1)) (DBG "check that file1 is _not_ recompiled, but file2 is" (file-write-date file1))
(assert-equal (- file1-date 120) (file-write-date file1)) (assert-equal (- file1-date 150) (file-write-date file1))
(assert (<= file2-date (file-write-date file2))) (assert (<= file2-date (file-write-date file2)))
(DBG "now touch file1 and check that file2 _is_ also recompiled") (DBG "now touch file1 and check that file2 _is_ also recompiled")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment