Skip to content

Commit

Permalink
The fix for log paths must be in both places (custom results do not u…
Browse files Browse the repository at this point in the history
…se _load_tmt_report_results_file())
  • Loading branch information
seberm committed Nov 22, 2024
1 parent 753cd1f commit 0077805
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions tmt/steps/execute/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 0077805

Please sign in to comment.