test1.script 1.49 KB
Newer Older
Daniel Barlow's avatar
Daniel Barlow committed
1
;;; -*- Lisp -*-
2
(load "script-support.lisp")
3
(load-asdf)
4

5
(quit-on-error
6
 (setf asdf:*central-registry* '(*default-pathname-defaults*))
7
 (asdf:load-system 'test1)
8
 ;; test that it compiled
9
10
 (let* ((file1 (asdf:compile-file-pathname* "file1"))
        (file2 (asdf:compile-file-pathname* "file2"))
11
12
        (file1-date (file-write-date file1))
        (file2-date (file-write-date file2)))
13

14
15
   (format t "~&test1 1: ~S ~S~%" file1 file1-date)
   (assert file1-date)
16
   (assert file2-date)
Daniel Barlow's avatar
Daniel Barlow committed
17

18
   (DBG "and loaded")
19
   (assert (symbol-value (find-symbol (symbol-name :*file1*) :test-package)))
Daniel Barlow's avatar
Daniel Barlow committed
20

21
   (DBG "now remove file2 that depends-on file1 check that file1 is _not_ recompiled, but file2 is")
22
   (asdf::run-shell-command "rm -f ~A" (namestring file2))
23
24
   ;; filesystem mtime has 1 second granularity. Make sure even fast machines see a difference.
   (sleep 1)
25
26
   (asdf:operate 'asdf:load-op 'test1)
   (assert (= file1-date (file-write-date file1)))
27
   (assert (< file2-date (file-write-date file2)))
Daniel Barlow's avatar
   
Daniel Barlow committed
28

29
   (DBG "now touch file1 and check that file2 _is_ also recompiled")
30
31
32
   ;; XXX run-shell-command loses if *default-pathname-defaults* is not the
   ;; unix cwd.  this is not a problem for run-tests.sh, but can be in general
   (let ((before (file-write-date file2)))
33
     ;; filesystem mtime has 1 second granularity. Make sure even fast machines see a difference.
34
     (sleep 1)
35
     (asdf::run-shell-command "touch file1.lisp")
36
     (asdf:operate 'asdf:load-op 'test1)
37
     (assert (> (file-write-date file2) before)))))