[Python-checkins] cpython: regrtest.py checks that child process exit code is zero

victor.stinner python-checkins at python.org
Thu Mar 31 18:16:37 CEST 2011


http://hg.python.org/cpython/rev/8472e76f3a5b
changeset: 69081:8472e76f3a5b
parent: 69079:8ff88324c9e9
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Thu Mar 31 18:02:36 2011 +0200
summary:
 regrtest.py checks that child process exit code is zero
files:
 Lib/test/regrtest.py | 8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -216,6 +216,7 @@
 SKIPPED = -2
 RESOURCE_DENIED = -3
 INTERRUPTED = -4
+CHILD_ERROR = -5 # error in a child process
 
 from test import support
 
@@ -579,10 +580,15 @@
 universal_newlines=True,
 close_fds=(os.name != 'nt'))
 stdout, stderr = popen.communicate()
+ retcode = popen.wait()
 # Strip last refcount output line if it exists, since it
 # comes from the shutdown of the interpreter in the subcommand.
 stderr = debug_output_pat.sub("", stderr)
 stdout, _, result = stdout.strip().rpartition("\n")
+ if retcode != 0:
+ result = (CHILD_ERROR, "Exit code %s" % retcode)
+ output.put((test, stdout.rstrip(), stderr.rstrip(), result))
+ return
 if not result:
 output.put((None, None, None, None))
 return
@@ -612,6 +618,8 @@
 if result[0] == INTERRUPTED:
 assert result[1] == 'KeyboardInterrupt'
 raise KeyboardInterrupt # What else?
+ if result[0] == CHILD_ERROR:
+ raise Exception(result[1])
 accumulate_result(test, result)
 test_index += 1
 except KeyboardInterrupt:
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /