source: trunk/abcl/test/lisp/ansi/package.lisp @ 13297

Last change on this file since 13297 was 13297, checked in by Mark Evenson, 12 years ago

Add LOAD-TESTS to load ANSI tests without actually executing them.

Refactor code into separate CLEAN-TEST and VERIFY-ANSI-TEST which
facilitates interactive use of the package.

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