diff options
author | Andres Gomez <agomez@igalia.com> | 2020-12-04 11:43:08 +0200 |
---|---|---|
committer | Andres Gomez <agomez@igalia.com> | 2020-12-17 22:32:40 +0200 |
commit | 859b32a97280b0722d04f5f90cd94d0b1392304c (patch) | |
tree | 9fe3cf9f73a62aa4ec4b14fe771f0bffd9e8a480 | |
parent | 902ac9d94096aa4bcf464fe8f10c35bbf80c46de (diff) |
framework/replay: rename dump image to include the checksum
Before, we were just replacing its name with the checksum. We don't
want to lose the original name so we just append the ckecksum.
Signed-off-by: Andres Gomez <agomez@igalia.com>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/426>
-rw-r--r-- | framework/replay/compare_replay.py | 4 | ||||
-rw-r--r-- | functionaltests/framework/replay/programs/test_compare.py | 4 | ||||
-rw-r--r-- | unittests/framework/replay/test_compare_replay.py | 73 |
3 files changed, 47 insertions, 34 deletions
diff --git a/framework/replay/compare_replay.py b/framework/replay/compare_replay.py index a27ca630c..287ddaa18 100644 --- a/framework/replay/compare_replay.py +++ b/framework/replay/compare_replay.py @@ -115,8 +115,8 @@ def _check_trace(trace_path, expected_checksum): result = Result.DIFFER if result is not Result.MATCH or OPTIONS.keep_image: - image_file_dest = path.join(path.dirname(image_file), - '{}.png'.format(checksum)) + root, ext = path.splitext(image_file) + image_file_dest = '{}-{}{}'.format(root, checksum, ext) shutil.move(image_file, image_file_dest) if 'images' in json_result: json_result['images'][0]['image_render'] = image_file_dest diff --git a/functionaltests/framework/replay/programs/test_compare.py b/functionaltests/framework/replay/programs/test_compare.py index 6a31508f1..9fee7abe8 100644 --- a/functionaltests/framework/replay/programs/test_compare.py +++ b/functionaltests/framework/replay/programs/test_compare.py @@ -41,8 +41,8 @@ from .backends import testtrace TESTS_OUTPUT = "results/output.txt" -TRACE_PNG_TEST1 = "results/trace/gl-test-device/trace1/8e0a801367e1714463475a824dab363b.png" -TRACE_PNG_TEST2 = "results/trace/vk-test-device/trace2/5efda83854befe0155ff8517a58d5b51.png" +TRACE_PNG_TEST1 = "results/trace/gl-test-device/trace1/magenta.testtrace-0-8e0a801367e1714463475a824dab363b.png" +TRACE_PNG_TEST2 = "results/trace/vk-test-device/trace2/olive.testtrace-0-5efda83854befe0155ff8517a58d5b51.png" logging.basicConfig(level=logging.INFO) logger = logging.getLogger() diff --git a/unittests/framework/replay/test_compare_replay.py b/unittests/framework/replay/test_compare_replay.py index 47142ebba..b40506c40 100644 --- a/unittests/framework/replay/test_compare_replay.py +++ b/unittests/framework/replay/test_compare_replay.py @@ -171,11 +171,13 @@ class TestCompareReplay(object): self.m_ensure_file.assert_called_once() self.m_backends_dump.assert_called_once() self.m_hexdigest_from_image.assert_called_once() + dumped_image_path = '{}-99.png'.format(self.trace_path) + root, ext = path.splitext(dumped_image_path) assert not self.tmpdir.join(self.results_partial_path, - self.trace_path + '-99.png').check() + dumped_image_path).check() assert not self.tmpdir.join(self.results_partial_path, - path.dirname(self.trace_path), - self.exp_checksum + '.png').check() + '{}-{}{}'.format( + root, self.exp_checksum, ext)).check() s = f.getvalue() assert s == ('[check_image]\n' ' actual: ' + self.exp_checksum + '\n' @@ -197,16 +199,20 @@ class TestCompareReplay(object): assert self.m_ensure_file.call_count == 2 assert self.m_backends_dump.call_count == 2 assert self.m_hexdigest_from_image.call_count == 2 + dumped_image_path = '{}-78.png'.format(second_trace_path) + root, ext = path.splitext(dumped_image_path) assert not self.tmpdir.join(self.results_partial_path, - second_trace_path + '-78.png').check() + dumped_image_path).check() + assert not self.tmpdir.join( + self.results_partial_path, + '{}-{}{}'.format(root, second_exp_checksum, ext)).check() + dumped_image_path = '{}-99.png'.format(self.trace_path) + root, ext = path.splitext(dumped_image_path) assert not self.tmpdir.join(self.results_partial_path, - path.dirname(second_trace_path), - second_exp_checksum + '.png').check() + dumped_image_path).check() assert not self.tmpdir.join(self.results_partial_path, - self.trace_path + '-99.png').check() - assert not self.tmpdir.join(self.results_partial_path, - path.dirname(self.trace_path), - self.exp_checksum + '.png').check() + '{}-{}{}'.format( + root, self.exp_checksum, ext)).check() s = f.getvalue() assert s == ('[check_image]\n' ' actual: ' + second_exp_checksum + '\n' @@ -232,11 +238,14 @@ class TestCompareReplay(object): self.m_ensure_file.assert_called_once() self.m_backends_dump.assert_called_once() self.m_hexdigest_from_image.assert_called_once() + dumped_image_path = '{}-99.png'.format(self.trace_path) + root, ext = path.splitext(dumped_image_path) assert not self.tmpdir.join(self.results_partial_path, - self.trace_path + '-99.png').check() - assert not self.tmpdir.join(self.results_partial_path, - path.dirname(self.trace_path), - self.exp_checksum + '.png').check() + dumped_image_path).check() + final_image_pathlib = self.tmpdir.join( + self.results_partial_path, '{}-{}{}'.format( + root, self.exp_checksum, ext)) + assert not final_image_pathlib.check() s = f.getvalue() assert s.endswith('PIGLIT: {"result": "pass"}\n') @@ -252,11 +261,14 @@ class TestCompareReplay(object): self.m_ensure_file.assert_called_once() self.m_backends_dump.assert_called_once() self.m_hexdigest_from_image.assert_called_once() + dumped_image_path = '{}-99.png'.format(self.trace_path) + root, ext = path.splitext(dumped_image_path) assert not self.tmpdir.join(self.results_partial_path, - self.trace_path + '-99.png').check() - assert self.tmpdir.join(self.results_partial_path, - path.dirname(self.trace_path), - self.exp_checksum + '.png').check() + dumped_image_path).check() + final_image_pathlib = self.tmpdir.join( + self.results_partial_path, '{}-{}{}'.format( + root, self.exp_checksum, ext)) + assert final_image_pathlib.check() s = f.getvalue() assert s.endswith('PIGLIT: {"result": "pass"}\n') @@ -272,21 +284,20 @@ class TestCompareReplay(object): self.m_ensure_file.assert_called_once() self.m_backends_dump.assert_called_once() self.m_hexdigest_from_image.assert_called_once() + dumped_image_path = '{}-99.png'.format(self.trace_path) + root, ext = path.splitext(dumped_image_path) assert not self.tmpdir.join(self.results_partial_path, - self.trace_path + '-99.png').check() - assert self.tmpdir.join(self.results_partial_path, - path.dirname(self.trace_path), - self.exp_checksum + '.png').check() + dumped_image_path).check() + final_image_pathlib = self.tmpdir.join( + self.results_partial_path, '{}-{}{}'.format( + root, self.exp_checksum, ext)) + assert final_image_pathlib.check() s = f.getvalue() assert s.endswith('PIGLIT: ' '{"images": [{' '"image_desc": "' + self.trace_path + '", ' '"image_ref": "' + wrong_checksum + '.png", ' - '"image_render": "' + - self.tmpdir.join(self.results_partial_path, - path.dirname(self.trace_path), - self.exp_checksum + - '.png').strpath + + '"image_render": "' + final_image_pathlib.strpath + '"}], "result": "fail"}\n') @pytest.mark.parametrize('trace_path', [ @@ -306,8 +317,10 @@ class TestCompareReplay(object): self.m_ensure_file.assert_called_once() self.m_backends_dump.assert_called_once() self.m_hexdigest_from_image.assert_not_called() - assert not self.tmpdir.join(self.results_partial_path, - path.dirname(trace_path), - third_exp_checksum + '.png').check() + root, ext = path.splitext('{}-99.png'.format(self.trace_path)) + final_image_pathlib = self.tmpdir.join( + self.results_partial_path, '{}-{}{}'.format( + root, third_exp_checksum, ext)) + assert not final_image_pathlib.check() s = f.getvalue() assert s.endswith('PIGLIT: {"result": "crash"}\n') |