From 7142f790e4ff6ca6f64e711d6722254643d32ccc Mon Sep 17 00:00:00 2001 From: "N. Engelhardt" Date: Thu, 24 Feb 2022 22:44:11 +0100 Subject: [PATCH] add testcase for overall run result --- sbysrc/sby_core.py | 21 +++++++++++++++++---- tests/junit_nocodeloc.sby | 20 ++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 tests/junit_nocodeloc.sby diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index b50ca3e..e1ee51c 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -766,8 +766,10 @@ class SbyTask: junit_skipped += 1 else: junit_errors += 1 - if junit_errors == 0 and self.status == "ERROR": - junit_errors = 1 + if self.retcode == 16: + junit_errors += 1 + elif self.retcode != 0: + junit_failures += 1 else: junit_tests = 1 junit_errors = 1 if self.retcode == 16 else 0 @@ -782,6 +784,13 @@ class SbyTask: print(f'', file=f) print(f'', file=f) if self.precise_prop_status: + print(f'', file=f) + if self.retcode == 16: + print(f'', file=f) # type mandatory, message optional + elif self.retcode != 0: + print(f'', file=f) + print(f'', file=f) + for check in checks: if junit_format_strict: detail_attrs = '' @@ -789,14 +798,18 @@ class SbyTask: detail_attrs = f' type="{check.type}" location="{check.location}" id="{check.name}"' if check.tracefile: detail_attrs += f' tracefile="{check.tracefile}"' - print(f'', file=f) + if check.location: + junit_prop_name = f"Property {check.type} in {check.hierarchy} at {check.location}" + else: + junit_prop_name = f"Property {check.type} {check.name} in {check.hierarchy}" + print(f'', file=f) if check.status == "PASS": pass elif check.status == "UNKNOWN": print(f'', file=f) elif check.status == "FAIL": traceinfo = f' Trace file: {check.tracefile}' if check.type == check.Type.ASSERT else '' - print(f'', file=f) + print(f'', file=f) elif check.status == "ERROR": print(f'', file=f) # type mandatory, message optional print(f'', file=f) diff --git a/tests/junit_nocodeloc.sby b/tests/junit_nocodeloc.sby new file mode 100644 index 0000000..5d2afc8 --- /dev/null +++ b/tests/junit_nocodeloc.sby @@ -0,0 +1,20 @@ +[options] +mode bmc + +expect fail + +[engines] +smtbmc boolector + +[script] +read -sv multi_assert.v +prep -top test +setattr -unset src + +[file multi_assert.v] +module test(); +always @* begin +assert (1); +assert (0); +end +endmodule -- 2.30.2