[cmucl-commit] [git] CMU Common Lisp branch master updated. snapshot-2013-12-a-45-g576eca2

Raymond Toy rtoy at common-lisp.net
Fri Jan 3 18:15:40 UTC 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".

The branch, master has been updated
       via  576eca29f2af906cd5931ebb338cb872ac10c912 (commit)
      from  a00d8a9a746933ad02f39fb22149a11299ea6a9b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 576eca29f2af906cd5931ebb338cb872ac10c912
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Fri Jan 3 10:15:33 2014 -0800

    Make interactive use of tests a little easier.
    
    * Split LOAD-AND-RUN-ALL-TESTS into two routines: one to load and one
      to run the tests.
    * Export the main routines.

diff --git a/tests/run-tests.lisp b/tests/run-tests.lisp
index 0a7da54..84df410 100644
--- a/tests/run-tests.lisp
+++ b/tests/run-tests.lisp
@@ -13,8 +13,11 @@
 
 (defpackage :cmucl-test-runner
   (:use :cl)
-  (:export #:run-all-tests
-	   #:load-and-run-all-tests
+  (:export #:*test-files*
+	   #:*test-names*
+	   #:load-test-files
+	   #:run-loaded-tests
+	   #:run-all-tests
 	   #:print-test-results))
 
 (in-package :cmucl-test-runner)
@@ -28,23 +31,30 @@
 
 (defvar *load-path* *load-pathname*)
 
+(defvar *test-files*
+  nil)
+
+(defvar *test-names*
+  nil)
+
+(defun load-test-files (&optional (test-directory #p"tests/"))
+  (dolist (file (directory (merge-pathnames "*.lisp" test-directory)))
+    (unless (equal file *load-path*)
+      (let ((basename (pathname-name file)))
+	(push (concatenate 'string (string-upcase basename) "-TESTS")
+	      *test-names*)
+	(push file *test-files*)
+	(load file))))
+  (setf *test-files* (nreverse *test-files*))
+  (setf *test-names* (nreverse *test-names*)))
+
 ;; Look through all the files in the tests directory and load them.
 ;; Then run all of the tests.  For each file, it ia assumed that a
 ;; package is created that is named with "-TESTS" appended to he
 ;; pathname-name of the file.
-(defun load-and-run-all-tests ()
-  (let (test-names
-	test-results)
-    (dolist (file (directory "tests/*.lisp"))
-      (unless (equal file *load-path*)
-	(let ((basename (pathname-name file)))
-	  ;; Create the package name from the pathname name so we know
-	  ;; how to run the test.
-	  (push (concatenate 'string (string-upcase basename) "-TESTS")
-		test-names)
-	  (load file))))
-    (setf test-names (nreverse test-names))
-    (dolist (test test-names)
+(defun run-loaded-tests ()
+  (let (test-results)
+    (dolist (test *test-names*)
       (push (lisp-unit:run-tests :all test)
 	    test-results))
     (nreverse test-results)))
@@ -89,8 +99,9 @@
 	  (t
 	   (unix:unix-exit 0)))))
 
-(defun run-all-tests ()
-  (print-test-results (load-and-run-all-tests)))
+(defun run-all-tests (&optional (test-directory #P"tests/"))
+  (load-test-files test-directory)
+  (print-test-results (run-loaded-tests)))
 
 ;;(run-all-tests)
 ;;(quit)

-----------------------------------------------------------------------

Summary of changes:
 tests/run-tests.lisp |   45 ++++++++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp


More information about the cmucl-commit mailing list