junit result: also write for aborted runs
Even if aborted due to signal, write a JUnit report XML, and make sure to indicate the runs as erratic. Change-Id: I7a334ef3463896c543c0fe592d3903c15e67d4c4
This commit is contained in:
parent
daf96e449e
commit
f8e6186406
|
@ -38,6 +38,7 @@ def suite_to_junit(suite):
|
|||
testsuite = et.Element('testsuite')
|
||||
testsuite.set('name', suite.name())
|
||||
testsuite.set('hostname', 'localhost')
|
||||
if suite.start_timestamp:
|
||||
testsuite.set('timestamp', datetime.fromtimestamp(round(suite.start_timestamp)).isoformat())
|
||||
testsuite.set('time', str(math.ceil(suite.duration)))
|
||||
testsuite.set('tests', str(len(suite.tests)))
|
||||
|
@ -60,6 +61,9 @@ def test_to_junit(test):
|
|||
if test.fail_tb:
|
||||
system_err = et.SubElement(testcase, 'system-err')
|
||||
system_err.text = test.fail_tb
|
||||
elif test.status != suite.Test.PASS:
|
||||
error = et.SubElement(testcase, 'error')
|
||||
error.text = 'could not run'
|
||||
return testcase
|
||||
|
||||
def trial_to_text(trial):
|
||||
|
|
|
@ -161,6 +161,8 @@ class SuiteRun(log.Origin):
|
|||
|
||||
trial = None
|
||||
status = None
|
||||
start_timestamp = None
|
||||
duration = None
|
||||
resources_pool = None
|
||||
reserved_resources = None
|
||||
objects_to_clean_up = None
|
||||
|
|
|
@ -188,6 +188,7 @@ class Trial(log.Origin):
|
|||
|
||||
def run_suites(self, names=None):
|
||||
self.status = Trial.UNKNOWN
|
||||
try:
|
||||
for suite_run in self.suites:
|
||||
try:
|
||||
suite_run.run_tests(names)
|
||||
|
@ -200,6 +201,7 @@ class Trial(log.Origin):
|
|||
self.status = Trial.FAIL
|
||||
if self.status == Trial.UNKNOWN:
|
||||
self.status = Trial.PASS
|
||||
finally:
|
||||
junit_path = self.get_run_dir().new_file(self.name()+'.xml')
|
||||
self.log('Storing JUnit report in', junit_path)
|
||||
report.trial_to_junit_write(self, junit_path)
|
||||
|
|
Loading…
Reference in New Issue