diff -r d7ec72c1620c Lib/test/libregrtest/main.py --- a/Lib/test/libregrtest/main.py Sat Jan 28 16:35:44 2017 +0900 +++ b/Lib/test/libregrtest/main.py Sat Jan 28 16:41:35 2017 -0500 @@ -408,7 +408,11 @@ if self.ns.use_mp: from test.libregrtest.runtest_mp import run_tests_multiprocess - run_tests_multiprocess(self) + from test.libregrtest.runtest_mp import ChildRunnerError + try: + run_tests_multiprocess(self) + except ChildRunnerError as e: + print(e.message) else: self.run_tests_sequential() diff -r d7ec72c1620c Lib/test/libregrtest/runtest_mp.py --- a/Lib/test/libregrtest/runtest_mp.py Sat Jan 28 16:35:44 2017 +0900 +++ b/Lib/test/libregrtest/runtest_mp.py Sat Jan 28 16:41:35 2017 -0500 @@ -26,6 +26,12 @@ WAIT_PROGRESS = 2.0 # seconds +class ChildRunnerError(Exception): + def __init__(self, message): + super(ChildRunnerError, self).__init__(message) + self.message = message + + def run_test_in_subprocess(testname, ns): """Run the given test in a subprocess with --slaveargs. @@ -174,6 +180,7 @@ running.append('%s (%.0f sec)' % (current_test, dt)) return running + runner_exception = None finished = 0 test_index = 1 get_timeout = max(PROGRESS_UPDATE, PROGRESS_MIN_TIME) @@ -218,7 +225,10 @@ raise KeyboardInterrupt if result[0] == CHILD_ERROR: msg = "Child error on {}: {}".format(test, result[1]) - raise Exception(msg) + runner_exception = ChildRunnerError(msg) + # Raise a KeyboardInterrupt to trigger the logic + # to wait for reamining tests + raise KeyboardInterrupt test_index += 1 except KeyboardInterrupt: regrtest.interrupted = True @@ -243,3 +253,6 @@ print(line) for worker in workers: worker.join(WAIT_PROGRESS) + + if runner_exception: + raise runner_exception