run-tests: keep a list of passed tests
authorMatt Mackall <mpm@selenic.com>
Fri, 22 Apr 2011 11:32:05 -0500
changeset 13992 ec4ae5727f07
parent 13991 8cfe191e2ce4
child 13993 174d0a113757
run-tests: keep a list of passed tests
tests/run-tests.py
--- a/tests/run-tests.py	Fri Apr 22 11:24:27 2011 -0500
+++ b/tests/run-tests.py	Fri Apr 22 11:32:05 2011 -0500
@@ -633,7 +633,7 @@
         output = re.sub(s, r, output)
     return ret, splitnewlines(output)
 
-def runone(options, test, skips, fails, ignores):
+def runone(options, test, skips, passes, fails, ignores):
     '''tristate output:
     None -> skipped
     True -> passed
@@ -745,6 +745,8 @@
         signal.alarm(0)
 
     mark = '.'
+    if ret == 0:
+        passes.append(test)
 
     skipped = (ret == SKIPPED_STATUS)
 
@@ -935,10 +937,6 @@
                 print 'WARNING: cannot run tests with timeouts'
                 options.timeout = 0
 
-        tested = 0
-        failed = 0
-        skipped = 0
-
         if options.restart:
             orig = list(tests)
             while tests:
@@ -949,6 +947,7 @@
                 print "running all tests"
                 tests = orig
 
+        passes = []
         skips = []
         fails = []
         ignores = []
@@ -958,21 +957,15 @@
                 filename = options.blacklist.get(test)
                 if filename is not None:
                     skipped.append((test, "blacklisted (%s)" % filename))
-                    skipped += 1
                     continue
 
             if options.retest and not os.path.exists(test + ".err"):
                 ignores.append((test, "not retesting"))
                 continue
 
-            ret = runone(options, test, skips, fails, ignores)
-            if ret is None:
-                skipped += 1
-            elif not ret:
-                failed += 1
-                if options.first:
-                    break
-            tested += 1
+            ret = runone(options, test, skips, passes, fails, ignores)
+            if options.first and ret is not None and not ret:
+                break
 
         if options.child:
             fp = os.fdopen(options.child, 'w')
@@ -990,7 +983,7 @@
                 print "Failed %s: %s" % s
             _checkhglib("Tested")
             print "# Ran %d tests, %d skipped, %d failed." % (
-                tested, len(skips) + len(ignores), failed)
+                len(passes) + len(fails), len(skips) + len(ignores), len(fails))
 
         if options.anycoverage:
             outputcoverage(options)
@@ -998,7 +991,7 @@
         failed = True
         print "\ninterrupted!"
 
-    if failed:
+    if fails:
         sys.exit(1)
 
 def main():