Patchwork [in,crew] run-tests: exit cleanly if parallel run is interrupted

login
register
mail settings
Submitter Bryan O'Sullivan
Date Jan. 15, 2013, 9:33 p.m.
Message ID <3ec94a908724d98240c1.1358285592@australite.thefacebook.com>
Download mbox | patch
Permalink /patch/631/
State Accepted
Commit 6880eae9f861efb2f017eb288b3a9617ee9d25cc
Headers show

Comments

Bryan O'Sullivan - Jan. 15, 2013, 9:33 p.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 1358285576 28800
# Node ID 3ec94a908724d98240c1f26ee05066cf96bdfb97
# Parent  7ac4449f0f39993b5e00985ecb3369abdbac18a3
run-tests: exit cleanly if parallel run is interrupted

If interrupted while running with "--jobs N", run-tests asynchronously
spewed a bunch of output and backtraces from both the master and
slave processes, leaving the terminal full of goop. This patch makes
it behave more sensibly.

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1125,8 +1125,8 @@  def runchildren(options, tests):
         pid, status, fp = waitq.get()
         try:
             childresults = pickle.load(fp)
-        except pickle.UnpicklingError:
-            pass
+        except (pickle.UnpicklingError, EOFError):
+            sys.exit(255)
         else:
             passed += len(childresults['p'])
             skipped += len(childresults['s'])
@@ -1221,7 +1221,8 @@  def runtests(options, tests):
             outputcoverage(options)
     except KeyboardInterrupt:
         failed = True
-        print "\ninterrupted!"
+        if not options.child:
+            print "\ninterrupted!"
 
     if failed:
         sys.exit(1)