From 74683fc6247c522ae955a6e7308b8ff51def35d8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 9 May 2017 11:34:01 +0200 Subject: [PATCH] bpo-30258: regrtest: Fix run_tests_multiprocess() (#1479) If the child process exited with a non-zero code, don't strip the last line of stdout anymore. Add also a sanity check in accumulate_result(). --- Lib/test/libregrtest/main.py | 2 ++ Lib/test/libregrtest/runtest_mp.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py index 2cfbdd12b2..e068b925d5 100644 --- a/Lib/test/libregrtest/main.py +++ b/Lib/test/libregrtest/main.py @@ -116,6 +116,8 @@ class Regrtest: elif ok == RESOURCE_DENIED: self.skipped.append(test) self.resource_denieds.append(test) + elif ok != INTERRUPTED: + raise ValueError("invalid test result: %r" % ok) def display_progress(self, test_index, test): if self.ns.quiet: diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py index 34b3ae6a97..779ff01a64 100644 --- a/Lib/test/libregrtest/runtest_mp.py +++ b/Lib/test/libregrtest/runtest_mp.py @@ -124,13 +124,13 @@ class MultiprocessThread(threading.Thread): finally: self.current_test = None - stdout, _, result = stdout.strip().rpartition("\n") if retcode != 0: result = (CHILD_ERROR, "Exit code %s" % retcode) self.output.put((test, stdout.rstrip(), stderr.rstrip(), result)) return False + stdout, _, result = stdout.strip().rpartition("\n") if not result: self.output.put((None, None, None, None)) return True -- 2.40.0