tests/run-tests.py
changeset 3321 b7a46cbf3f59
parent 3307 3cd51b986172
child 3624 a90a86929d04
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -32,6 +32,11 @@ parser.add_option("-s", "--cover_stdlib"
     help="print a test coverage report inc. standard libraries")
 parser.add_option("-C", "--annotate", action="store_true",
     help="output files annotated with coverage")
+parser.add_option("-r", "--retest", action="store_true",
+    help="retest failed tests")
+parser.add_option("-f", "--first", action="store_true",
+    help="exit on the first test failure")
+
 parser.set_defaults(timeout=180)
 (options, args) = parser.parse_args()
 verbose = options.verbose
@@ -360,11 +365,16 @@ try:
             if (test.startswith("test-") and '~' not in test and
                 ('.' not in test or test.endswith('.py') or
                  test.endswith('.bat'))):
+                if options.retest and not os.path.exists(test + ".err"):
+                    skipped += 1
+                    continue
                 ret = run_one(test)
                 if ret is None:
                     skipped += 1
                 elif not ret:
                     failed += 1
+                    if options.first:
+                        break
                 tests += 1
 
         print "\n# Ran %d tests, %d skipped, %d failed." % (tests, skipped,