test1.script 1.3 KB
Newer Older
Daniel Barlow's avatar
Daniel Barlow committed
1
;;; -*- Lisp -*-
2
(load "script-support")
Daniel Barlow's avatar
Daniel Barlow committed
3
(load "../asdf")
4
(quit-on-error 
5
6
 (setf asdf:*central-registry* '(*default-pathname-defaults*))
 (asdf:operate 'asdf:load-op 'test1)
Daniel Barlow's avatar
Daniel Barlow committed
7

8
 ;; test that it compiled
9
10
11
 (defvar file1-date (file-write-date (compile-file-pathname "file1"))))

(quit-on-error 
12
 (assert (and file1-date (file-write-date (compile-file-pathname "file2")))))
Daniel Barlow's avatar
Daniel Barlow committed
13
14
15
16

;; and loaded
(assert test-package::*file1*)

17
(quit-on-error 
18
19
20
 ;; 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
21

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

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

30
31
 ;; 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
32

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