Comments
Patch
@@ -544,17 +544,18 @@ def outputcoverage(options):
class Test(object):
"""Encapsulates a single, runnable test.
Test instances can be run multiple times via run(). However, multiple
runs cannot be run concurrently.
"""
- def __init__(self, path, options, count, refpath):
+ def __init__(self, test, path, options, count, refpath):
+ self._test = test
self._path = path
self._options = options
self._count = count
self._daemonpids = []
# If we're not in --debug mode and reference output file exists,
# check test output against it.
if options.debug:
@@ -591,17 +592,19 @@ class Test(object):
try:
ret, out = self._run(testtmp, replacements, env)
updateduration()
result.ret = ret
result.out = out
except KeyboardInterrupt:
updateduration()
- result.interrupted = True
+ log('INTERRUPTED: %s (after %d seconds)' % (self._test,
+ result.duration))
+ raise
except Exception, e:
updateduration()
result.exception = e
killdaemons(env['DAEMON_PIDS'])
result.refout = self._refout
@@ -666,17 +669,16 @@ class Test(object):
class TestResult(object):
"""Holds the result of a test execution."""
def __init__(self):
self.ret = None
self.out = None
self.duration = None
- self.interrupted = False
self.exception = None
self.refout = None
@property
def skipped(self):
"""Whether the test was skipped."""
return self.ret == SKIPPED_STATUS
@@ -1084,25 +1086,21 @@ def runone(options, test, count):
else:
return skip("unknown test type")
vlog("# Test", test)
if os.path.exists(err):
os.remove(err) # Remove any previous output files
- t = runner(testpath, options, count, ref)
+ t = runner(test, testpath, options, count, ref)
res = TestResult()
t.run(res)
del t # For cleanup side-effects.
- if res.interrupted:
- log('INTERRUPTED: %s (after %d seconds)' % (test, res.duration))
- raise KeyboardInterrupt()
-
if res.exception:
return fail('Exception during execution: %s' % res.exception, 255)
ret = res.ret
out = res.out
times.append((test, res.duration))
vlog("# Ret was:", ret)