diff options
author | Tomeu Vizoso <tomeu.vizoso@collabora.com> | 2021-04-28 17:18:18 +0200 |
---|---|---|
committer | Tomeu Vizoso <tomeu.vizoso@collabora.com> | 2021-05-20 14:01:33 +0200 |
commit | 9f16a6a4581c6cb5bdbc830586d4bff7dd4d7ce7 (patch) | |
tree | 0451d3df4fc1f27171d5ace06169af01bae8b18a /framework | |
parent | 5c7aca943f769013bad0c100b27b47e9cb5e35f1 (diff) |
framework/replay: Use the Status enum from the framework
I would need to add a new Result enum that contains PASS and FAIL for
the profile subcommand, but then the transformations from Result to
Status looks quite pointless.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/483>
Diffstat (limited to 'framework')
-rw-r--r-- | framework/replay/compare_replay.py | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/framework/replay/compare_replay.py b/framework/replay/compare_replay.py index c67c76340..4cb523703 100644 --- a/framework/replay/compare_replay.py +++ b/framework/replay/compare_replay.py @@ -44,18 +44,10 @@ from framework.replay.image_checksum import hexdigest_from_image from framework.replay.options import OPTIONS -__all__ = ['Result', - 'from_yaml', +__all__ = ['from_yaml', 'trace'] -@unique -class Result(Enum): - FAILURE = -1 - MATCH = 0 - DIFFER = 1 - - def _replay(trace_path, results_path): try: success = backends.dump(trace_path, results_path, []) @@ -104,21 +96,21 @@ def _check_trace(trace_path, expected_checksum): if checksum is None: json_result['images'][0]['image_render'] = None - return Result.FAILURE, json_result + return status.CRASH, json_result if checksum == expected_checksum: if not OPTIONS.keep_image: os.remove(image_file) print('[check_image] Images match for:\n {}\n'.format(trace_path)) - result = Result.MATCH + result = status.PASS else: print('[check_image] Images differ for:\n {}'.format(trace_path)) print('[check_image] For more information see ' 'https://gitlab.freedesktop.org/' 'mesa/piglit/blob/master/replayer/README.md\n') - result = Result.DIFFER + result = status.FAIL - if result is not Result.MATCH or OPTIONS.keep_image: + if result is not status.PASS or OPTIONS.keep_image: root, ext = path.splitext(image_file) image_file_dest = '{}-{}{}'.format(root, checksum, ext) shutil.move(image_file, image_file_dest) @@ -129,12 +121,7 @@ def _check_trace(trace_path, expected_checksum): def _print_result(result, trace_path, json_result): output = 'PIGLIT: ' - if result is Result.FAILURE: - json_result['result'] = str(status.CRASH) - elif result is Result.DIFFER: - json_result['result'] = str(status.FAIL) - else: - json_result['result'] = str(status.PASS) + json_result['result'] = str(result) output += json.dumps(json_result) print(output) @@ -145,13 +132,13 @@ def from_yaml(yaml_file): OPTIONS.set_download_url(qty.download_url(y)) - global_result = Result.MATCH + global_result = status.PASS # TODO: print in subtest format # json_results = {} t_list = qty.traces(y, device_name=OPTIONS.device_name, checksum=True) for t in t_list: result, json_result = _check_trace(t['path'], t['checksum']) - if result is not Result.MATCH and global_result is not Result.FAILURE: + if result is not status.PASS and global_result is not status.CRASH: global_result = result # json_results.update(json_result) # _print_result(result, t['path'], json_result) |