Skip to content

Commit 55c3dde

Browse files
committed
twister: fix json reporting of build only tests
Tests are reported as skipped if they are only being built. Fix this by checking for the correct status. Fixes #37475 Signed-off-by: Anas Nashif <[email protected]>
1 parent 8dcfa91 commit 55c3dde

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

scripts/pylib/twister/twisterlib.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3675,7 +3675,6 @@ def json_report(self, filename, append=False, version="NA"):
36753675
handler_time = instance.metrics.get('handler_time', 0)
36763676
ram_size = instance.metrics.get ("ram_size", 0)
36773677
rom_size = instance.metrics.get("rom_size",0)
3678-
36793678
for k in instance.results.keys():
36803679
testcases = list(filter(lambda d: not (d.get('testcase') == k and d.get('platform') == p), testcases ))
36813680
testcase = {"testcase": k,
@@ -3687,12 +3686,12 @@ def json_report(self, filename, append=False, version="NA"):
36873686
if rom_size:
36883687
testcase["rom_size"] = rom_size
36893688

3690-
if instance.results[k] in ["PASS"]:
3689+
if instance.results[k] in ["PASS"] or instance.status == 'passed':
36913690
testcase["status"] = "passed"
36923691
if instance.handler:
36933692
testcase["execution_time"] = handler_time
36943693

3695-
elif instance.results[k] in ['FAIL', 'BLOCK'] or instance.status in ["error", "failed", "timeout"]:
3694+
elif instance.results[k] in ['FAIL', 'BLOCK'] or instance.status in ["error", "failed", "timeout", "flash_error"]:
36963695
testcase["status"] = "failed"
36973696
testcase["reason"] = instance.reason
36983697
testcase["execution_time"] = handler_time
@@ -3702,7 +3701,7 @@ def json_report(self, filename, append=False, version="NA"):
37023701
testcase["device_log"] = self.process_log(device_log)
37033702
else:
37043703
testcase["build_log"] = self.process_log(build_log)
3705-
else:
3704+
elif instance.status == 'skipped':
37063705
testcase["status"] = "skipped"
37073706
testcase["reason"] = instance.reason
37083707
testcases.append(testcase)

0 commit comments

Comments
 (0)