mirror of
https://github.com/lowRISC/ibex.git
synced 2025-04-22 21:07:34 -04:00
Simplify the logic in check_ibex_uvm_log
Also fix a minor nit: if something had gone really weird and we saw a pass message followed by a fail message, the previous code would have treated the test as a pass. Now it is treated as a failure.
This commit is contained in:
parent
88a1859616
commit
53ecd9770d
1 changed files with 15 additions and 9 deletions
|
@ -145,30 +145,36 @@ def check_ibex_uvm_log(uvm_log, core_name, test_name, report, write=True):
|
|||
signature
|
||||
|
||||
"""
|
||||
pass_cnt = 0
|
||||
fail_cnt = 0
|
||||
passed = False
|
||||
failed = False
|
||||
|
||||
with open(uvm_log, "r") as log:
|
||||
for line in log:
|
||||
if 'RISC-V UVM TEST PASSED' in line:
|
||||
pass_cnt += 1
|
||||
break
|
||||
elif 'RISC-V UVM TEST FAILED' in line:
|
||||
fail_cnt += 1
|
||||
passed = True
|
||||
|
||||
if 'RISC-V UVM TEST FAILED' in line:
|
||||
failed = True
|
||||
break
|
||||
|
||||
# If we saw PASSED and FAILED, that's a bit odd. But we should treat the
|
||||
# test as having failed.
|
||||
if failed:
|
||||
passed = False
|
||||
|
||||
if write:
|
||||
fd = open(report, "a+") if report else sys.stdout
|
||||
|
||||
fd.write("%s uvm log : %s\n" % (core_name, uvm_log))
|
||||
if pass_cnt == 1:
|
||||
if passed:
|
||||
fd.write("%s : [PASSED]\n\n" % test_name)
|
||||
elif fail_cnt == 1:
|
||||
elif failed:
|
||||
fd.write("%s : [FAILED]\n\n" % test_name)
|
||||
|
||||
if report:
|
||||
fd.close()
|
||||
|
||||
return pass_cnt == 1
|
||||
return passed
|
||||
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue