From 00778054b076b974bc3eeda017b89c2a52324b8e Mon Sep 17 00:00:00 2001 From: Otto Sabart Date: Fri, 22 Nov 2024 22:11:12 +0100 Subject: [PATCH] The fix for log paths must be in both places (custom results do not use _load_tmt_report_results_file()) --- tmt/steps/execute/__init__.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tmt/steps/execute/__init__.py b/tmt/steps/execute/__init__.py index e48ccd6391..103af4fced 100644 --- a/tmt/steps/execute/__init__.py +++ b/tmt/steps/execute/__init__.py @@ -791,12 +791,6 @@ def _load_tmt_report_results_file(self, invocation: TestInvocation) -> ResultCol collection.file_exists = True collection.results = tmt.utils.yaml_to_list(results_path.read_text()) - # Fix log paths created by `tmt-report-result` on the guest, which are by default relative - # to the `TMT_TEST_DATA`, to be relative to the `execute` directory. - for result in collection.results: - result["log"] = [str(invocation.relative_test_data_path / log) - for log in result.get("log", [])] - return collection def _process_results_partials( @@ -837,6 +831,11 @@ def _process_results_partials( partial_result.name = '/' + partial_result.name partial_result.name = test.name + partial_result.name + # Fix log paths as user provides relative path to `TMT_TEST_DATA`, but Result has to + # point relative to the execute workdir + partial_result.log = [ + invocation.relative_test_data_path / log for log in partial_result.log] + # Include the default output log if no log provided if not partial_result.log and default_log is not None: partial_result.log.append(default_log) @@ -912,6 +911,12 @@ def extract_tmt_report_results(self, invocation: TestInvocation) -> list["tmt.Re collection.validate() + # Fix log paths created by `tmt-report-result` on the guest, which are by default relative + # to the `TMT_TEST_DATA`, to be relative to the `execute` directory. + for result in collection.results: + result["log"] = [ + str(invocation.relative_test_data_path / log) for log in result.get("log", [])] + return [tmt.Result.from_serialized(result) for result in collection.results] def extract_tmt_report_results_restraint(