run-tests.py: Show paths to failing tests, .err and .out
authorMads Kiilerich <mads@kiilerich.com>
Wed, 16 Dec 2009 12:09:25 +0100
changeset 10088 ec8304e66ea5
parent 10087 b1982715c435
child 10089 8fab31727037
run-tests.py: Show paths to failing tests, .err and .out I think this is very convenient when investigating and fixing test failures, but perhaps it must be tweaked further to show paths if and only if it is appropriate.
tests/run-tests.py
--- a/tests/run-tests.py	Wed Dec 16 16:46:12 2009 -0600
+++ b/tests/run-tests.py	Wed Dec 16 12:09:25 2009 +0100
@@ -251,9 +251,8 @@
 
     return missing, failed
 
-def showdiff(expected, output):
-    for line in difflib.unified_diff(expected, output,
-            "Expected output", "Test output"):
+def showdiff(expected, output, ref, err):
+    for line in difflib.unified_diff(expected, output, ref, err):
         sys.stdout.write(line)
 
 def findprogram(program):
@@ -452,13 +451,13 @@
         if not options.verbose:
             skips.append((test, msg))
         else:
-            print "\nSkipping %s: %s" % (test, msg)
+            print "\nSkipping %s: %s" % (testpath, msg)
         return None
 
     def fail(msg):
         fails.append((test, msg))
         if not options.nodiff:
-            print "\nERROR: %s %s" % (test, msg)
+            print "\nERROR: %s %s" % (testpath, msg)
         return None
 
     vlog("# Test", test)
@@ -565,7 +564,7 @@
         else:
             fail("output changed")
         if not options.nodiff:
-            showdiff(refout, out)
+            showdiff(refout, out, ref, err)
         ret = 1
     elif ret:
         mark = '!'