changeset 7343:e47dab64be8d

run-tests: allow turning off diff display
author Matt Mackall <mpm@selenic.com>
date Fri, 07 Nov 2008 16:28:52 -0600
parents 1dcd2cc6878b
children 58fd3c718ca4
files tests/run-tests.py
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run-tests.py	Fri Nov 07 15:30:25 2008 -0600
+++ b/tests/run-tests.py	Fri Nov 07 16:28:52 2008 -0600
@@ -63,6 +63,8 @@
     help="run tests in the given temporary directory")
 parser.add_option("-v", "--verbose", action="store_true",
     help="output verbose messages")
+parser.add_option("-n", "--nodiff", action="store_true",
+    help="skip showing test changes")
 parser.add_option("--with-hg", type="string",
     help="test existing install at given location")
 
@@ -71,6 +73,7 @@
 parser.set_defaults(**defaults)
 (options, args) = parser.parse_args()
 verbose = options.verbose
+nodiff = options.nodiff
 coverage = options.cover or options.cover_stdlib or options.annotate
 python = sys.executable
 
@@ -308,7 +311,8 @@
 
     def fail(msg):
         fails.append((test, msg))
-        print "\nERROR: %s %s" % (test, msg)
+        if not nodiff:
+            print "\nERROR: %s %s" % (test, msg)
         return None
 
     vlog("# Test", test)
@@ -374,6 +378,8 @@
     if options.timeout > 0:
         signal.alarm(0)
 
+    mark = '.'
+
     skipped = (ret == SKIPPED_STATUS)
     # If reference output file exists, check test output against it
     if os.path.exists(ref):
@@ -383,22 +389,26 @@
     else:
         ref_out = []
     if skipped:
+        mark = 's'
         missing = extract_missing_features(out)
         if not missing:
             missing = ['irrelevant']
         skip(missing[-1])
     elif out != ref_out:
+        mark = '!'
         if ret:
             fail("output changed and returned error code %d" % ret)
         else:
             fail("output changed")
-        show_diff(ref_out, out)
+            if not nodiff:
+                show_diff(ref_out, out)
         ret = 1
     elif ret:
+        mark = '!'
         fail("returned error code %d" % ret)
 
     if not verbose:
-        sys.stdout.write(skipped and 's' or '.')
+        sys.stdout.write(mark)
         sys.stdout.flush()
 
     if ret != 0 and not skipped: