[PATCH in crew] tests: correctly report a test killed by a signal

Bryan O'Sullivan bos at serpentine.com
Thu Oct 11 18:06:54 CDT 2012


# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1349996714 25200
# Node ID 4871c1f343fae9f38b9dc9600ab96f2017d116ce
# Parent  aad3bce98f7676529e5650a612bee129b37c191b
tests: correctly report a test killed by a signal

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -921,6 +921,11 @@ def runone(options, test):
             f.write(line)
         f.close()
 
+    def describe(ret):
+        if ret < 0:
+            return 'killed by signal %d' % -ret
+        return 'returned error code %d' % ret
+
     if skipped:
         mark = 's'
         if out is None:                 # debug mode: nothing to parse
@@ -948,13 +953,13 @@ def runone(options, test):
                 showdiff(refout, out, ref, err)
             iolock.release()
         if ret:
-            fail("output changed and returned error code %d" % ret, ret)
+            fail("output changed and " + describe(ret), ret)
         else:
             fail("output changed", ret)
         ret = 1
     elif ret:
         mark = '!'
-        fail("returned error code %d" % ret, ret)
+        fail(describe(ret), ret)
     else:
         success()
 


More information about the Mercurial-devel mailing list