return self_script
def AfterRun(self, result):
- if self.self_script and (not result.HasPreciousOutput()):
+ if self.self_script and (not result or (not result.HasPreciousOutput())):
test.CheckedUnlink(self.self_script)
class MjsunitTestConfiguration(test.TestConfiguration):
def AfterRun(self, result):
# Dispose the temporary file if everything looks okay.
- if not result.HasPreciousOutput(): self.tmpfile.Dispose()
+ if result is None or not result.HasPreciousOutput(): self.tmpfile.Dispose()
self.tmpfile = None
def GetCommand(self):
start = time.time()
output = case.Run()
case.duration = (time.time() - start)
+ except BreakNowException:
+ self.terminate = True
except IOError, e:
assert self.terminate
return
# --- F r a m e w o r k ---
# -------------------------
+class BreakNowException(Exception):
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return repr(self.value)
+
class CommandOutput(object):
def Run(self):
self.BeforeRun()
- result = "exception"
+ result = None
try:
result = self.RunCommand(self.GetCommand())
+ except:
+ self.terminate = True
+ raise BreakNowException("Used pressed CTRL+C or IO went wrong")
finally:
self.AfterRun(result)
return result
self.output.exit_code != -signal.SIGABRT
def HasTimedOut(self):
- return self.output.timed_out;
+ return self.output.timed_out
def HasFailed(self):
execution_failed = self.test.DidFail(self.output)
def RunTestCases(cases_to_run, progress, tasks):
progress = PROGRESS_INDICATORS[progress](cases_to_run)
- return progress.Run(tasks)
+ result = 0
+ try:
+ result = progress.Run(tasks)
+ except Exception, e:
+ print "\n", e
+ return result
def BuildRequirements(context, requirements, mode, scons_flags):
print "shard-run not a valid number, should be in [1:shard-count]"
print "defaulting back to running all tests"
return tests
- count = 0;
+ count = 0
shard = []
for test in tests:
if count % options.shard_count == options.shard_run - 1:
- shard.append(test);
+ shard.append(test)
count += 1
return shard