Change failure modes and add comments with more clarifying details

This commit is contained in:
Harry Callahan 2022-10-05 11:23:06 +01:00
parent 3650e08e4e
commit 0e396d5944
2 changed files with 7 additions and 6 deletions

View file

@ -31,6 +31,7 @@ def compare_test_run(trr: TestRunResult) -> TestRunResult:
"""
# If the test timed-out, return early to avoid overwriting the failure_mode.
# Don't check the logs at all in this case.
if (trr.failure_mode == Failure_Modes.TIMEOUT):
trr.passed = False
return trr
@ -41,7 +42,7 @@ def compare_test_run(trr: TestRunResult) -> TestRunResult:
uvm_pass, uvm_log_lines = check_ibex_uvm_log(trr.rtl_log)
except IOError as e:
trr.passed = False
trr.failure_mode = Failure_Modes.PARSE_ERROR
trr.failure_mode = Failure_Modes.FILE_ERROR
trr.failure_message = f"[FAILED] Could not open simulation log: {e}\n"
return trr
if not uvm_pass:
@ -62,7 +63,7 @@ def compare_test_run(trr: TestRunResult) -> TestRunResult:
process_ibex_sim_log(trr.rtl_trace, trr.dir_test/'rtl_trace.csv')
except (OSError, RuntimeError) as e:
trr.passed = False
trr.failure_mode = Failure_Modes.LOG_ERROR
trr.failure_mode = Failure_Modes.FILE_ERROR
trr.failure_message = f"[FAILED]: Log processing failed: {e}"
return trr
@ -74,7 +75,7 @@ def compare_test_run(trr: TestRunResult) -> TestRunResult:
raise RuntimeError('Unsupported simulator for cosim')
except (OSError, RuntimeError) as e:
trr.passed = False
trr.failure_mode = Failure_Modes.LOG_ERROR
trr.failure_mode = Failure_Modes.FILE_ERROR
trr.failure_message = f"[FAILED]: Log processing failed: {e}"
return trr

View file

@ -20,9 +20,9 @@ class Failure_Modes(Enum):
"""Descriptive enum for the mode in which a test fails"""
NONE = 0
TIMEOUT = 1
PARSE_ERROR = 2
LOG_ERROR = 3
TIMEOUT = 1 # The simulation process did not complete within the timeout
FILE_ERROR = 2 # There was a problem attempting to open a logfile
LOG_ERROR = 3 # The contents of a logfile met a criterion for test failure
def __str__(self):
"""Print enumerated values as e.g. TIMEOUT(1)"""