Skip to content

Commit

Permalink
test: print failing frame during replay test
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Jun 30, 2023
1 parent 95f1618 commit 67d34be
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/run_replay_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,14 @@ def on_result_updated(w: ReplayResultUpdatedHandler):
num_frames = w.result['replay_log_frames']
duration = w.result['duration']
fps = w.result['fps']
print_progress_str(
f'{time_format(duration)}, {fps} fps, {last_frame} / {num_frames}')
progress_str = f'{time_format(duration)}, {fps} fps, {last_frame} / {num_frames}'
if w.result.get('success') == False:
failing_frame = w.result.get('failing_frame', None)
if failing_frame != None:
progress_str += f', failure on frame {failing_frame}'
else:
progress_str += ', failure'
print_progress_str(progress_str)

watcher = ReplayResultUpdatedHandler(result_path, on_result_updated)

Expand Down Expand Up @@ -692,6 +698,7 @@ def on_result_updated(w: ReplayResultUpdatedHandler):

player_interface.wait_for_finish()
watcher.update_result()
on_result_updated(watcher)
result.duration = watcher.result['duration']
result.fps = int(watcher.result['fps'])
result.frame = int(watcher.result['frame'])
Expand Down Expand Up @@ -803,6 +810,9 @@ def on_result_updated(w: ReplayResultUpdatedHandler):
message = f'{status_emoji} {time_format(result.duration)}'
if result.fps != None:
message += f', {result.fps} fps'
if not result.success:
if result.failing_frame != None:
message += f', failure on frame {result.failing_frame}'
print(message)

# Only print on failure and last attempt.
Expand Down

0 comments on commit 67d34be

Please sign in to comment.