summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_regrtest.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-02-06 11:42:00 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-02-06 11:42:00 (GMT)
commit5bad70def671612835d1fdacd83f8534920f4dcd (patch)
treeb80b13b2f7bd3b431281b2d4ee9ed77f62c69e21 /Lib/test/test_regrtest.py
parent7b620a448e95387cdd79c56937a700deb6079b14 (diff)
downloadcpython-5bad70def671612835d1fdacd83f8534920f4dcd.zip
cpython-5bad70def671612835d1fdacd83f8534920f4dcd.tar.gz
cpython-5bad70def671612835d1fdacd83f8534920f4dcd.tar.bz2
regrtest: don't fail immediately if a child does crash
Issue #29362: Catch a crash of a worker process as a normal failure and continue to run next tests. It allows to get the usual test summary: single line result (OK/FAIL), total duration, etc.
Diffstat (limited to 'Lib/test/test_regrtest.py')
-rw-r--r--Lib/test/test_regrtest.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index 6d70e4d..0bd6298 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -354,7 +354,7 @@ class BaseTestCase(unittest.TestCase):
self.assertRegex(output, regex)
def parse_executed_tests(self, output):
- regex = (r'^[0-9]+:[0-9]+:[0-9]+ \[ *[0-9]+(?:/ *[0-9]+)?\] (%s)'
+ regex = (r'^[0-9]+:[0-9]+:[0-9]+ \[ *[0-9]+(?:/ *[0-9]+)*\] (%s)'
% self.TESTNAME_REGEX)
parser = re.finditer(regex, output, re.MULTILINE)
return list(match.group(1) for match in parser)
@@ -809,6 +809,17 @@ class ArgsTestCase(BaseTestCase):
self.assertEqual(output.rstrip().splitlines(),
tests)
+ def test_crashed(self):
+ # Any code which causes a crash
+ code = 'import faulthandler; faulthandler._sigsegv()'
+ crash_test = self.create_test(name="crash", code=code)
+ ok_test = self.create_test(name="ok")
+
+ tests = [crash_test, ok_test]
+ output = self.run_tests("-j2", *tests, exitcode=1)
+ self.check_executed_tests(output, tests, failed=crash_test,
+ randomize=True)
+
if __name__ == '__main__':
unittest.main()