summaryrefslogtreecommitdiff
path: root/lib/harness.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2019-11-19 14:00:05 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2019-11-19 14:00:05 +0100
commitb5a52bde0f7c24b5d263d279d9137ead88c41723 (patch)
tree1353dc364411b7731d3e1ebece6ffc2a9b54758c /lib/harness.py
parent713cb59e65ac44eb02a09bbe4860863064a155af (diff)
harness: abort run on UART error
Diffstat (limited to 'lib/harness.py')
-rw-r--r--lib/harness.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/harness.py b/lib/harness.py
index c986002..d6594cc 100644
--- a/lib/harness.py
+++ b/lib/harness.py
@@ -65,6 +65,7 @@ class TransitionHarness:
self.traces = []
self.trace_id = 0
self.repetitions = 0
+ self.abort = False
self.done = False
self.synced = False
@@ -75,6 +76,7 @@ class TransitionHarness:
Resets `done` and `synced`.
"""
self.repetitions = 0
+ self.abort = False
self.done = False
self.synced = False
@@ -218,11 +220,13 @@ class TransitionHarness:
print(' Offending line: {}'.format(line))
return
if log_data_target['isa'] != 'transition':
+ self.abort = True
raise RuntimeError('Log mismatch: Expected transition, got {:s}'.format(log_data_target['isa']))
if self.pta:
transition = self.pta.transitions[transition_id]
if transition.name != log_data_target['name']:
- raise RuntimeError('Log mismatch: Expected transition {:s}, got transition {:s}'.format(log_data_target['name'], transition.name))
+ self.abort = True
+ raise RuntimeError('Log mismatch: Expected transition {:s}, got transition {:s} -- may have been caused by preceding malformed UART output'.format(log_data_target['name'], transition.name))
if self.log_return_values and len(transition.return_value_handlers):
for handler in transition.return_value_handlers:
if 'parameter' in handler:
@@ -328,6 +332,7 @@ class OnboardTimerHarness(TransitionHarness):
cycles = int(res.group(2))
overflow = int(res.group(3))
if overflow >= self.counter_max_overflow:
+ self.abort = True
raise RuntimeError('Counter overflow ({:d}/{:d}) in benchmark id={:d} trace={:d}: transition #{:d} (ID {:d})'.format(cycles, overflow, 0, self.trace_id, self.current_transition_in_trace, transition_id))
duration_us = cycles * self.one_cycle_in_us + overflow * self.one_overflow_in_us
# TODO subtract 'nop' cycles
@@ -342,12 +347,14 @@ class OnboardTimerHarness(TransitionHarness):
print(' Offending line: {}'.format(line))
return
if log_data_target['isa'] != 'transition':
+ self.abort = True
raise RuntimeError('Log mismatch in benchmark id={:d} trace={:d}: transition #{:d} (ID {:d}): Expected transition, got {:s}'.format(0,
self.trace_id, self.current_transition_in_trace, transition_id, log_data_target['isa']))
if self.pta:
transition = self.pta.transitions[transition_id]
if transition.name != log_data_target['name']:
- raise RuntimeError('Log mismatch in benchmark id={:d} trace={:d}: transition #{:d} (ID {:d}): Expected transition {:s}, got transition {:s}'.format(0, self.trace_id, self.current_transition_in_trace, transition_id, log_data_target['name'], transition.name))
+ self.abort = True
+ raise RuntimeError('Log mismatch in benchmark id={:d} trace={:d}: transition #{:d} (ID {:d}): Expected transition {:s}, got transition {:s} -- may have been caused by preceding maformed UART output'.format(0, self.trace_id, self.current_transition_in_trace, transition_id, log_data_target['name'], transition.name, line))
if self.log_return_values and len(transition.return_value_handlers):
for handler in transition.return_value_handlers:
if 'parameter' in handler: