test1.script 1.36 KB
Newer Older
Daniel Barlow's avatar
Daniel Barlow committed
1
;;; -*- Lisp -*-
2
(load "script-support")
3
(load (compile-file-pathname "../asdf"))
4

5
(quit-on-error
6
7
 (setf asdf:*central-registry* '(*default-pathname-defaults*))
 (asdf:operate 'asdf:load-op 'test1)
Daniel Barlow's avatar
Daniel Barlow committed
8

9
 ;; test that it compiled
Robert P. Goldman's avatar
Robert P. Goldman committed
10
 (defvar file1-date (file-write-date (asdf:compile-file-pathname* "file1")))
11

Robert P. Goldman's avatar
Robert P. Goldman committed
12
 (assert (and file1-date (file-write-date (asdf:compile-file-pathname* "file2"))))
Daniel Barlow's avatar
Daniel Barlow committed
13

Robert P. Goldman's avatar
Robert P. Goldman committed
14
15
 ;; and loaded
 (assert (eval (intern (symbol-name '#:*file1*) :test-package)))
Daniel Barlow's avatar
Daniel Barlow committed
16

17
18
19
 ;; now remove one output file and check that the other is _not_
 ;; recompiled
 (sleep 1) ; mtime has 1-second granularity, so pause here for fast machines
Daniel Barlow's avatar
Daniel Barlow committed
20

21
 (asdf::run-shell-command "rm -f ~A"
22
                          (namestring (asdf:compile-file-pathname* "file2")))
23
 (asdf:operate 'asdf:load-op 'test1)
24
25
 (assert (= file1-date (file-write-date (asdf:compile-file-pathname* "file1"))))
 (assert (file-write-date (asdf:compile-file-pathname* "file2")))
Daniel Barlow's avatar
   
Daniel Barlow committed
26

27
 ;; now touch file1 and check that file2 _is_ also recompiled
Daniel Barlow's avatar
   
Daniel Barlow committed
28

29
30
 ;; 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
Daniel Barlow's avatar
   
Daniel Barlow committed
31

32
 (let ((before (file-write-date (asdf:compile-file-pathname* "file2"))))
33
34
35
   (asdf::run-shell-command "touch file1.lisp")
   (sleep 1)
   (asdf:operate 'asdf:load-op 'test1)
36
   (assert (>  (file-write-date (asdf:compile-file-pathname* "file2")) before))))