1 | (defpackage #:abcl.test.ansi |
---|
2 | (:use :cl :cl-user) |
---|
3 | (:nicknames #:ansi-tests #:abcl-ansi-tests #:gcl-ansi) |
---|
4 | (:export #:run |
---|
5 | #:verify-ansi-tests |
---|
6 | #:load-tests |
---|
7 | #:clean-tests |
---|
8 | #:full-report |
---|
9 | #:report #:parse)) |
---|
10 | |
---|
11 | (in-package :abcl.test.ansi) |
---|
12 | |
---|
13 | (defparameter *ansi-tests-master-source-location* |
---|
14 | "<svn://common-lisp.net/project/ansi-test/svn/trunk/ansi-tests>") |
---|
15 | |
---|
16 | (defparameter *ansi-tests-directory* |
---|
17 | (if (find :asdf2 *features*) |
---|
18 | (asdf:system-relative-pathname :ansi-compiled "../ansi-tests/") |
---|
19 | (merge-pathnames #p"../ansi-tests/" |
---|
20 | (asdf:component-pathname |
---|
21 | (asdf:find-system :ansi-compiled))))) |
---|
22 | |
---|
23 | (defun run (&key (compile-tests nil)) |
---|
24 | "Run the ANSI-TESTS suite, to be found in *ANSI-TESTS-DIRECTORY*. |
---|
25 | Possibly running the compiled version of the tests if COMPILE-TESTS is non-NIL." |
---|
26 | (verify-ansi-tests) |
---|
27 | (let* ((ansi-tests-directory |
---|
28 | *ansi-tests-directory*) |
---|
29 | (boot-file |
---|
30 | (if compile-tests "compileit.lsp" "doit.lsp")) |
---|
31 | (message |
---|
32 | (format nil "Invocation of '~A' in ~A" |
---|
33 | boot-file ansi-tests-directory))) |
---|
34 | (progv |
---|
35 | '(*default-pathname-defaults*) |
---|
36 | `(,(merge-pathnames *ansi-tests-directory* |
---|
37 | *default-pathname-defaults*)) |
---|
38 | (format t "---> ~A begins.~%" message) |
---|
39 | (format t "Invoking ABCL hosted on ~A ~A.~%" |
---|
40 | (software-type) (software-version)) |
---|
41 | (time (load boot-file)) |
---|
42 | (format t "<--- ~A ends.~%" message)))) |
---|
43 | |
---|
44 | (defun verify-ansi-tests () |
---|
45 | (unless |
---|
46 | (probe-file *ansi-tests-directory*) |
---|
47 | (error 'file-error |
---|
48 | "Failed to find the GCL ANSI tests in '~A'. Please |
---|
49 | locally obtain ~A, and set the value of *ANSI-TESTS-DIRECTORY* to that |
---|
50 | location." |
---|
51 | *ansi-tests-directory* |
---|
52 | *ansi-tests-master-source-location*))) |
---|
53 | |
---|
54 | (defvar *ansi-tests-loaded-p* nil) |
---|
55 | (defun load-tests () |
---|
56 | "Load the ANSI tests but do not execute them." |
---|
57 | (verify-ansi-tests) |
---|
58 | (let ((*default-pathname-defaults* *ansi-tests-directory*) |
---|
59 | (package *package*)) |
---|
60 | (setf *package* (find-package :cl-user)) |
---|
61 | (load "gclload1.lsp") |
---|
62 | (load "gclload2.lsp") |
---|
63 | (setf *package* package)) |
---|
64 | (setf *ansi-tests-loaded-p* t)) |
---|
65 | |
---|
66 | (defun clean-tests () |
---|
67 | "Do what 'make clean' would do from the GCL ANSI tests," |
---|
68 | ;; so we don't have to hunt for 'make' in the PATH on win32. |
---|
69 | (verify-ansi-tests) |
---|
70 | |
---|
71 | (mapcar #'delete-file |
---|
72 | (append (directory (format nil "~A/*.cls" *ansi-tests-directory*)) |
---|
73 | (directory (format nil "~A/*.abcl" *ansi-tests-directory*)) |
---|
74 | (directory (format nil "~A/scratch/*" *ansi-tests-directory*)) |
---|
75 | (mapcar (lambda(x) |
---|
76 | (format nil "~A/~A" *ansi-tests-directory* x)) |
---|
77 | '("scratch/" |
---|
78 | "scratch.txt" "foo.txt" "foo.lsp" |
---|
79 | "foo.dat" |
---|
80 | "tmp.txt" "tmp.dat" "tmp2.dat" |
---|
81 | "temp.dat" "out.class" |
---|
82 | "file-that-was-renamed.txt" |
---|
83 | "compile-file-test-lp.lsp" |
---|
84 | "compile-file-test-lp.out" |
---|
85 | "ldtest.lsp"))))) |
---|
86 | |
---|
87 | |
---|
88 | |
---|
89 | |
---|