From 3eba9641ab352e9a67fdde3231df0d41ccdbb52d Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 17 Mar 2014 02:05:17 +0000 Subject: [PATCH] [SCons] Continue running test suite if Python tests crash If the Python test suite crashes, it won't save a results file, but we can still run the rest of the tests and report this specific failure. --- test/SConscript | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test/SConscript b/test/SConscript index 70dd4a96e..24b1776e2 100644 --- a/test/SConscript +++ b/test/SConscript @@ -98,15 +98,18 @@ def addPythonTest(testname, subdir, script, interpreter, outfile, if not code: # Test was successful open(target[0].path, 'w').write(time.asctime()+'\n') - else: - testResults.failed[testname] = True - for line in open(outfile): - status, name = line.strip().split(': ', 1) - if status == 'PASS': - testResults.passed[':'.join((testname,name))] = 1 - elif status in ('FAIL', 'ERROR'): - testResults.failed[':'.join((testname,name))] = 1 + if os.path.exists(outfile): + # Determine individual test status + for line in open(outfile): + status, name = line.strip().split(': ', 1) + if status == 'PASS': + testResults.passed[':'.join((testname,name))] = 1 + elif status in ('FAIL', 'ERROR'): + testResults.failed[':'.join((testname,name))] = 1 + else: + # Total failure - unable to determine status of individual tests + testResults.failed[testname] = True testenv = localenv.Clone() passedFile = File(pjoin(subdir, '%s.passed' % testname))