Bug 1235 - test.py reports success on invalid tests
authorMitch Watrous <watrous@u.washington.edu>
Tue, 09 Aug 2011 16:27:17 -0700
changeset 7411 9b4d53a854bb
parent 7410 21169501d589
child 7412 d79278c6e51c
Bug 1235 - test.py reports success on invalid tests
test.py
--- a/test.py	Tue Aug 09 11:36:18 2011 -0400
+++ b/test.py	Tue Aug 09 16:27:17 2011 -0700
@@ -1132,7 +1132,15 @@
     # execution quite easily.
     #
     if len(options.suite):
-        suites = options.suite + "\n"
+        # See if this is a valid test suite.
+        path_cmd = os.path.join("utils", "test-runner --print-test-name-list")
+        (rc, suites, standard_err, et) = run_job_synchronously(path_cmd, os.getcwd(), False, False)
+        if options.suite in suites:
+            suites = options.suite + "\n"
+        else:
+            print >> sys.stderr, 'The test suite was not run because an unknown test suite name was requested.'
+            sys.exit(2)
+
     elif len(options.example) == 0 and len(options.pyexample) == 0:
         if len(options.constrain):
             path_cmd = os.path.join("utils", "test-runner --print-test-name-list --test-type=%s" % options.constrain)