Running a subset of the testsuite



>>>>> "Raymond" == Raymond Toy  writes:

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

    Robert> About run_testsuite, I like the idea of a list of filenames
    Robert> argument. I have a couple of ideas. One is that the default
    Robert> list could be a Maxima list, so that it is easy to reassign.

    Raymond> So we can have (in maxima) testsuite_files be a list of files (and
    Raymond> failed tests) to be run?  That's sounds good too.  I'll have to think
    Raymond> a little harder about the implementation, but it shouldn't be hard.

FWIW, here is a patch that implements this idea.  It's not very nice,
but it works.  I'm not sure I would want to expose this list to the
casual user though.  Plus, we don't have an easy way to reset the
default, other than by loading testsuite.lisp.

Ray


diff -u -r1.25 mload.lisp
--- src/mload.lisp	12 Apr 2005 04:13:18 -0000	1.25
+++ src/mload.lisp	13 Apr 2005 15:38:11 -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
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	13 Apr 2005 15:38:11 -0000
@@ -5,8 +5,9 @@
 ;;; 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"
+(setf $testsuite_files
+      '((mlist simp)
+	"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)