source: trunk/abcl/test/lisp/ansi/abcl-ansi.lisp @ 14180

Last change on this file since 14180 was 14180, checked in by Mark Evenson, 8 years ago

Invoke ANSI-TESTS:DO-TESTS-MATCHING in proper directory.

File size: 3.3 KB
Line 
1(in-package :abcl.test.ansi)
2
3(defparameter *ansi-tests-master-source-location*
4  "<svn://common-lisp.net/project/ansi-test/svn/trunk/ansi-tests>") 
5
6(defparameter *ansi-tests-directory*
7  (if (find :asdf2 *features*)
8      (asdf:system-relative-pathname :ansi-compiled "../ansi-tests/")
9      (merge-pathnames #p"../ansi-tests/"
10           (asdf:component-pathname 
11      (asdf:find-system :ansi-compiled)))))
12
13(defun run (&key (compile-tests nil)) 
14  "Run the ANSI-TESTS suite, to be found in *ANSI-TESTS-DIRECTORY*.
15Possibly running the compiled version of the tests if COMPILE-TESTS is non-NIL."
16  (verify-ansi-tests)
17  (let* ((ansi-tests-directory 
18    *ansi-tests-directory*)
19   (boot-file 
20    (if compile-tests "compileit.lsp" "doit.lsp"))
21   (message 
22    (format nil "Invocation of '~A' in ~A" 
23      boot-file ansi-tests-directory)))
24    (progv 
25  '(*default-pathname-defaults*) 
26  `(,(merge-pathnames *ansi-tests-directory* 
27          *default-pathname-defaults*))
28    (format t "--->  ~A begins.~%" message)
29    (format t "Invoking ABCL hosted on ~A ~A.~%" 
30      (software-type) (software-version))
31    (time (load boot-file))
32    (format t "<--- ~A ends.~%" message))))
33
34(defun verify-ansi-tests () 
35  (unless 
36      (probe-file *ansi-tests-directory*)
37    (error 'file-error
38     "Failed to find the GCL ANSI tests in '~A'. Please
39locally obtain ~A, and place it in a sibling directory to the ABCL source named '../ansi-tests/'"
40       *ansi-tests-directory*
41       *ansi-tests-master-source-location*)))
42
43(defvar *ansi-tests-loaded-p* nil)
44(defun load-tests ()
45  "Load the ANSI tests but do not execute them."
46  (verify-ansi-tests)
47  (let ((*default-pathname-defaults* *ansi-tests-directory*)
48  (package *package*))
49    (setf *package* (find-package :cl-user))
50    (load "gclload1.lsp")
51    (load "gclload2.lsp")
52    (setf *package* package))
53  (setf *ansi-tests-loaded-p* t))
54 
55(defun clean-tests ()
56  "Do what 'make clean' would do from the GCL ANSI tests,"
57  ;; so we don't have to hunt for 'make' in the PATH on win32.
58  (verify-ansi-tests)
59
60  (mapcar #'delete-file
61    (append (directory (format nil "~A/*.cls" *ansi-tests-directory*))
62      (directory (format nil "~A/*.abcl" *ansi-tests-directory*))
63      (directory (format nil "~A/scratch/*" *ansi-tests-directory*))
64      (mapcar (lambda(x) 
65          (format nil "~A/~A" *ansi-tests-directory* x))
66        '("scratch/"
67          "scratch.txt" "foo.txt" "foo.lsp"
68          "foo.dat" 
69          "tmp.txt" "tmp.dat" "tmp2.dat"
70          "temp.dat" "out.class" 
71          "file-that-was-renamed.txt"
72          "compile-file-test-lp.lsp"
73          "compile-file-test-lp.out" 
74          "ldtest.lsp")))))
75
76;;; XXX move this into test-utilities.lisp?
77(defvar *last-run-matching* "bit-vector")
78
79(defun do-tests-matching (&optional (match *last-run-matching*))
80  "Run all tests in suite whose symbol contains MATCH in a case-insensitive manner."
81  (setf *last-run-matching* match)
82  (let* ((matching (string-upcase match))
83         (count 0)
84         (*default-pathname-defaults* *ansi-tests-directory*))
85    (mapcar (lambda (entry) 
86              (if (search matching (symbol-name (rt::name entry)))
87                  (setf (rt::pend entry) t
88                        count (1+ count))
89                  (setf (rt::pend entry) nil)))
90            (rest rt::*entries*))
91    (format t "Performing ~A tests matching '~A'.~%" count matching)
92    (rt::do-entries t)))
Note: See TracBrowser for help on using the repository browser.