run-tests.py must print changed test output no matter what exit code is.
authorVadim Gelfer <vadim.gelfer@gmail.com>
Fri, 05 May 2006 10:41:38 -0700
changeset 2213 6f76a479ae51
parent 2212 8164e3f31638
child 2214 6c6c0e5595a2
run-tests.py must print changed test output no matter what exit code is.
tests/run-tests.py
--- a/tests/run-tests.py	Fri May 05 10:31:03 2006 -0700
+++ b/tests/run-tests.py	Fri May 05 10:41:38 2006 -0700
@@ -176,18 +176,20 @@
     ret, out = run(cmd)
     vlog("# Ret was:", ret)
 
-    if ret == 0:
-        # If reference output file exists, check test output against it
-        if os.path.exists(ref):
-            f = open(ref, "r")
-            ref_out = f.read().splitlines()
-            f.close()
-            if out != ref_out:
-                ret = 1
-                print "\nERROR: %s output changed" % (test)
-                show_diff(ref_out, out)
-    else:
+    diffret = 0
+    # If reference output file exists, check test output against it
+    if os.path.exists(ref):
+        f = open(ref, "r")
+        ref_out = f.read().splitlines()
+        f.close()
+        if out != ref_out:
+            diffret = 1
+            print "\nERROR: %s output changed" % (test)
+            show_diff(ref_out, out)
+    if ret:
         print "\nERROR: %s failed with error code %d" % (test, ret)
+    elif diffret:
+        ret = diffret
 
     if ret != 0: # Save errors to a file for diagnosis
         f = open(err, "w")