Testsuite: only print msg when timeout kills process unexpectedly
authorThomas Miedema <thomasmiedema@gmail.com>
Thu, 3 Sep 2015 14:13:42 +0000 (16:13 +0200)
committerThomas Miedema <thomasmiedema@gmail.com>
Thu, 3 Sep 2015 22:06:17 +0000 (00:06 +0200)
Differential Revision: https://phabricator.haskell.org/D1207

testsuite/driver/testlib.py
testsuite/timeout/timeout.py

index 5a587a7..ee6f631 100644 (file)
@@ -1798,6 +1798,10 @@ def rawSystemWithTimeout(cmd_and_args):
     if r == 98:
         # The python timeout program uses 98 to signal that ^C was pressed
         stopNow()
+    if r == 99 and getTestOpts().exit_code != 99:
+        # Only print a message when timeout killed the process unexpectedly.
+        cmd = cmd_and_args[-1]
+        if_verbose(1, 'Timeout happened...killed process "{}"...\n'.format(cmd))
     return r
 
 # cmd is a complex command in Bourne-shell syntax
index 1016e2d..51fb63c 100644 (file)
@@ -35,8 +35,6 @@ try:
     else:
         # parent
         def handler(signum, frame):
-            msg = 'Timeout happened...killing process %s...\n' % cmd
-            sys.stderr.write(msg)
             killProcess(pid)
             sys.exit(99)
         old = signal.signal(signal.SIGALRM, handler)