diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2019-11-19 14:00:05 +0100 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2019-11-19 14:00:05 +0100 |
commit | b5a52bde0f7c24b5d263d279d9137ead88c41723 (patch) | |
tree | 1353dc364411b7731d3e1ebece6ffc2a9b54758c | |
parent | 713cb59e65ac44eb02a09bbe4860863064a155af (diff) |
harness: abort run on UART error
-rwxr-xr-x | bin/generate-dfa-benchmark.py | 4 | ||||
-rw-r--r-- | lib/harness.py | 11 |
2 files changed, 13 insertions, 2 deletions
diff --git a/bin/generate-dfa-benchmark.py b/bin/generate-dfa-benchmark.py index c88a5f7..23aa627 100755 --- a/bin/generate-dfa-benchmark.py +++ b/bin/generate-dfa-benchmark.py @@ -240,6 +240,10 @@ def run_benchmark(application_file: str, pta: PTA, runs: list, arch: str, app: s print('[RUN] has been unsynced for more than 30 seconds, assuming error. Retrying.') sync_error = True break + if harness.abort: + print('[RUN] harness encountered an error. Retrying') + sync_error = True + break time.sleep(5) slept += 5 print('[RUN] {:d}/{:d} ({:.0f}%), current benchmark at {:.0f}%'.format(run_offset, runs_total, run_offset * 100 / runs_total, slept * 100 / run_timeout)) 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: |