Running a subset of the testsuite



>>>>> "Robert" == Robert Dodier  writes:

    Robert> Well, I'm OK with testsuite_files, but can we make
    Robert> the default directory file_search_tests ? 
    Robert> For consistency with file_search_maxima, file_search_lisp,
    Robert> file_search_demo, and file_search_usage. 
    Robert> Can we also make file_search_tests a list (even if it is
    Robert> a list of one element) ? Again, that is consistent with
    Robert> the existing search directory variables.

Ok, that wasn't so hard.  I done as you've suggested.
file_search_tests is a list of directories/patterns to search for the
test files.  testsuite_files is a maxima list of the tests that we
want to run.  run_testsuite takes an optional third parameter to
specify which tests we want to run from testsuite_files.

One thing I forget to mention is that if, say, you only want to run
rtest14, only rtest14 is run, but we use the expected tests from the
rtest14 entry in testsuite_files.  Not sure if that's what we want.

Anyway, here is a patch that implements these ideas, in case anyone
wants to play with this.  Patch is a diff against the latest CVS
sources.

Someone else will have to decide if this should go into 5.9.2 or not.


Ray

diff -u -r1.43 init-cl.lisp
--- src/init-cl.lisp	3 Apr 2005 23:35:54 -0000	1.43
+++ src/init-cl.lisp	18 Apr 2005 16:43:28 -0000
@@ -62,6 +62,10 @@
   "Directories to search for demos.")
 
 (defvar $file_search_usage nil)
+
+(defvar $file_search_tests nil
+  "Directories to search for maxima test suite")
+
 (defvar $chemin nil)
 
 
@@ -234,6 +238,8 @@
 		(combine-path (list *maxima-sharedir* share-subdirs
 				    usage-patterns))
 		(combine-path (list *maxima-docdir* usage-patterns))))
+    (setq $file_search_tests
+	  `((mlist) ,(combine-path (list *maxima-testsdir* maxima-patterns))))
     (setq $chemin
 	  (list '(mlist)
 		(combine-path (list *maxima-symdir* lisp-patterns))
Index: src/mload.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/mload.lisp,v
retrieving revision 1.26
diff -u -r1.26 mload.lisp
--- src/mload.lisp	13 Apr 2005 00:58:51 -0000	1.26
+++ src/mload.lisp	18 Apr 2005 16:43:29 -0000
@@ -956,19 +956,41 @@
 
   
   
-(defvar *testsuite-files* nil)
+(defmvar $testsuite_files nil)
 
 (defvar *maxima-testsdir*)
 
-(defun $run_testsuite (&optional (show-known-bugs nil) (show-all nil)) 
+(defun intersect-tests (tests)
+  ;; If TESTS is non-NIL, we assume it's a Maxima list of (maxima)
+  ;; strings naming the tests we want to run.  They must match the
+  ;; file names in $testsuite_files.  We ignore any items that aren't
+  ;; in $testsuite_files.
+  (mapcar #'(lambda (x)
+	      (if (symbolp x)
+		  (subseq (print-invert-case x) 1)
+		  x))
+	  (cond (tests
+		 (intersection (cdr $testsuite_files)
+			       (cdr tests)
+			       :key #'(lambda (x)
+					(maxima-string (if (listp x)
+							   (car x)
+							   x)))
+			       :test #'string=))
+		(t
+		 (cdr $testsuite_files)))))
+
+(defun $run_testsuite (&optional (show-known-bugs nil) (show-all nil) (tests nil)) 
   (let ((test-file)
 	(expected-failures))
     (setq *collect-errors* nil)
-    (load (concatenate 'string *maxima-testsdir* "/" "testsuite.lisp"))
+    (unless $testsuite_files
+      (load (concatenate 'string *maxima-testsdir* "/" "testsuite.lisp")))
     (let ((error-break-file)
-	  (testresult))
+	  (testresult)
+	  (tests-to-run (intersect-tests tests)))
       (time 
-       (loop with errs = '() for testentry in *testsuite-files*
+       (loop with errs = '() for testentry in tests-to-run
 	      do
 	      (if (atom testentry)
 		  (progn
@@ -983,8 +1005,7 @@
 		   (progn
 		     (setq testresult 
 			   (rest (test-batch
-				  (format nil "~a/~a" 
-					  *maxima-testsdir* test-file)
+				  ($file_search test-file $file_search_tests)
 				  expected-failures
 				  :show-expected show-known-bugs
 				  :show-all show-all)))
Index: tests/testsuite.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/tests/testsuite.lisp,v
retrieving revision 1.18
diff -u -r1.18 testsuite.lisp
--- tests/testsuite.lisp	13 Mar 2005 01:28:12 -0000	1.18
+++ tests/testsuite.lisp	18 Apr 2005 16:43:29 -0000
@@ -5,15 +5,16 @@
 ;;; of the test problems that are expected to fail, e.g.
 ;;; ("testfile.mac" 7 9 13).
 
-(setf *testsuite-files*
-      '("rtestnset.mac" "rtest1.mac" "rtest1a.mac" "rtest2.mac" "rtest4.mac"  "rtest5.mac"
-	"rtest6.mac" "rtest6a.mac" "rtest6b.mac" "rtest7.mac" "rtest9.mac"
-	"rtest9a.mac" "rtest10.mac" "rtest11.mac" "rtest13.mac" "rtest13s.mac"
-	("rtest14.mac" 57 63)
-	("rtest15.mac" 4)
-	("rtest16.mac" 4)
-	"rtestode.mac" "rtestode_zp.mac"
-	"rtest3.mac" "rtest8.mac" "rtest12.mac" "rexamples.mac"
-	"rtesthyp.mac"
-    "rtestmt19937.mac"
+(setf $testsuite_files
+      '((mlist simp)
+	"rtestnset" "rtest1" "rtest1a" "rtest2" "rtest4"  "rtest5"
+	"rtest6" "rtest6a" "rtest6b" "rtest7" "rtest9"
+	"rtest9a" "rtest10" "rtest11" "rtest13" "rtest13s"
+	("rtest14" 57 63)
+	("rtest15" 4)
+	("rtest16" 4)
+	"rtestode" "rtestode_zp"
+	"rtest3" "rtest8" "rtest12" "rexamples"
+	"rtesthyp"
+	"rtestmt19937"
 	))