Commit 715940af authored by Daniel Barlow's avatar Daniel Barlow

new test files

parent a28bd5a2
(defpackage :test-package (:use "CL"))
(in-package :test-package)
(defvar *file1* t)
(in-package :test-package)
(assert *file1*)
(defpackage :test-package (:use "CL"))
(in-package :test-package)
(defvar *file3* t)
(in-package :test-package)
(assert *file3*)
#!/bin/sh
# This needs to
# - read lisp forms one at a time from standard input
# - quit with exit status 0 on getting eof
# - quit with exit status >0 if an unhandled error occurs
LISP="sbcl --noprogrammer"
# file extension that compiling fiels with $LISP will use
FASL=fasl
rm *.$FASL || true
for i in *.script;
do
rm *.$FASL || true
if $LISP < $i ;then
echo "$i passed"
else
echo "$i failed"
exit 1
fi
done
;;; -*- Lisp -*-
(asdf:defsystem test1
:components ((:file "file2" :in-order-to ((compile-op (load-op "file1"))))
(:file "file1")))
#|
1) from clean, check that all fasl files build and that some function
defined in the second file is present
2) delete the second fasl file, and build again. do test 1 again and
also check the date on file1.fasl
|#
;;; -*- Lisp -*-
(load "../asdf")
(setf asdf:*central-registry* '(*default-pathname-defaults*))
(asdf:oos 'asdf:load-op 'test1)
;; test that it compiled
(defvar file1-date (file-write-date (compile-file-pathname "file1")))
(assert (and file1-date (file-write-date (compile-file-pathname "file2"))))
;; and loaded
(assert test-package::*file1*)
;; 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
(asdf::run-shell-command "rm ~A"
(namestring (compile-file-pathname "file2")))
(asdf:oos 'asdf:load-op 'test1)
(assert (= file1-date (file-write-date (compile-file-pathname "file1"))))
(assert (file-write-date (compile-file-pathname "file2")))
;;; -*- Lisp -*-
(asdf:defsystem test2b
:version "1.0"
:components ((:file "file2" :in-order-to ((compile-op (load-op "file1"))))
(:file "file1"))
:depends-on (version 'test2a "1.1"))
;;; -*- Lisp -*-
(load "../asdf")
(setf asdf:*central-registry* '(*default-pathname-defaults*))
;(trace asdf::perform)
;(trace asdf::find-component)
;(trace asdf::traverse)
(asdf:oos 'asdf:load-op 'test2b1)
(assert (and (file-write-date (compile-file-pathname "file3"))
(file-write-date (compile-file-pathname "file4"))))
(handler-case
(asdf:oos 'asdf:load-op 'test2b2)
(asdf:missing-dependency (c)
(format t "load failed as expected: - ~%~A~%" c))
(:no-error (c) (error "should have failed, oops")))
;;; -*- Lisp -*-
(asdf:defsystem test2a
:version "1.1"
:components ((:file "file4" :in-order-to ((compile-op (load-op "file3"))))
(:file "file3")))
#|
this system is referenced by test2b[12]
|#
;;; -*- Lisp -*-
(asdf:defsystem test2b1
:version "1.0"
:components ((:file "file2" :in-order-to ((compile-op (load-op "file1"))))
(:file "file1"))
:in-order-to ((load-op (load-op (version test2a "1.1")))))
;;; -*- Lisp -*-
(asdf:defsystem test2b2
:version "1.0"
:components ((:file "file2" :in-order-to ((compile-op (load-op "file1"))))
(:file "file1"))
:in-order-to ((load-op (load-op (version test2a "1.2")))))
;;; -*- Lisp -*-
(asdf:defsystem test2b3
:version "1.0"
:components ((:file "file2" :in-order-to ((compile-op (load-op "file1"))))
(:file "file1"))
:depends-on (bet-you-cant-find-this))
;;; -*- Lisp -*-
(asdf:defsystem test3
:components
((:module "deps"
:if-component-dep-fails :try-next
:pathname "."
:components
((:file "file1" :in-order-to ((compile-op (feature :f1))))
(:file "file2" :in-order-to ((compile-op (feature :f2))))))))
;;; -*- Lisp -*-
#+(or f1 f2)
(error "This test cannot run if :f1 or :f2 are on *features*")
(load "../asdf")
(setf asdf:*central-registry* '(*default-pathname-defaults*))
(in-package :asdf)
(handler-case
(asdf:oos 'asdf:load-op 'test3)
(missing-dependency (c)
(format t "first test failed as expected: - ~%~A~%" c))
(:no-error (c) (error "should have failed, oops")))
(pushnew :f1 *features*)
(asdf:oos 'asdf:load-op 'test3)
(assert (file-write-date (compile-file-pathname "file1")))
(assert (not (file-write-date (compile-file-pathname "file2"))))
(run-shell-command "rm ~A" (namestring (compile-file-pathname "file1")))
(setf *features* (cons :f2 (cdr *features*)))
(asdf:oos 'asdf:load-op 'test3)
(assert (file-write-date (compile-file-pathname "file2")))
(assert (not (file-write-date (compile-file-pathname "file1"))))
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