Skip to content

Commit 8355b83

Browse files
committed
Merge branch 'ci/add-python-func-and-fix-c-testcase-path-in-junit-report' into 'master'
ci: add python_func attribute and fix C testcase path resolution in JUnit reports Closes RDT-1013, IDFCI-1990, IDFCI-1964, and IDFCI-1429 See merge request espressif/esp-idf!35058
2 parents c004b93 + c03b007 commit 8355b83

File tree

7 files changed

+105
-59
lines changed

7 files changed

+105
-59
lines changed

tools/ci/dynamic_pipelines/models.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
1+
# SPDX-FileCopyrightText: 2024-2025 Espressif Systems (Shanghai) CO LTD
22
# SPDX-License-Identifier: Apache-2.0
33
import inspect
44
import os
@@ -8,6 +8,7 @@
88
from xml.etree.ElementTree import Element
99

1010
import yaml
11+
from idf_ci_utils import IDF_PATH
1112

1213

1314
class Job:
@@ -130,6 +131,7 @@ class TestCase:
130131
name: str
131132
file: str
132133
time: float
134+
app_path: t.Optional[str] = None
133135
failure: t.Optional[str] = None
134136
skipped: t.Optional[str] = None
135137
ci_job_url: t.Optional[str] = None
@@ -150,6 +152,13 @@ def is_skipped(self) -> bool:
150152
def is_success(self) -> bool:
151153
return not self.is_failure and not self.is_skipped
152154

155+
@classmethod
156+
def _get_idf_rel_path(cls, path: str) -> str:
157+
if path.startswith(IDF_PATH):
158+
return os.path.relpath(path, IDF_PATH)
159+
else:
160+
return path
161+
153162
@classmethod
154163
def from_test_case_node(cls, node: Element) -> t.Optional['TestCase']:
155164
if 'name' not in node.attrib:
@@ -163,6 +172,9 @@ def from_test_case_node(cls, node: Element) -> t.Optional['TestCase']:
163172
kwargs = {
164173
'name': node.attrib['name'],
165174
'file': node.attrib.get('file'),
175+
'app_path': '|'.join(
176+
cls._get_idf_rel_path(path) for path in node.attrib.get('app_path', 'unknown').split('|')
177+
),
166178
'time': float(node.attrib.get('time') or 0),
167179
'ci_job_url': node.attrib.get('ci_job_url') or 'Not found',
168180
'ci_dashboard_url': f'{grafana_base_url}?{encoded_params}',

tools/ci/dynamic_pipelines/report.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -788,15 +788,15 @@ def get_failed_cases_report_parts(self) -> t.List[str]:
788788
items=failed_test_cases_cur_branch,
789789
headers=[
790790
'Test Case',
791-
'Test Script File Path',
791+
'Test App Path',
792792
'Failure Reason',
793793
f'Failures on your branch (40 latest testcases)',
794794
'Dut Log URL',
795795
'Create Known Failure Case Jira',
796796
'Job URL',
797797
'Grafana URL',
798798
],
799-
row_attrs=['name', 'file', 'failure', 'dut_log_url', 'ci_job_url', 'ci_dashboard_url'],
799+
row_attrs=['name', 'app_path', 'failure', 'dut_log_url', 'ci_job_url', 'ci_dashboard_url'],
800800
value_functions=[
801801
(
802802
'Failures on your branch (40 latest testcases)',
@@ -813,15 +813,15 @@ def get_failed_cases_report_parts(self) -> t.List[str]:
813813
items=failed_test_cases_other_branch,
814814
headers=[
815815
'Test Case',
816-
'Test Script File Path',
816+
'Test App Path',
817817
'Failure Reason',
818818
'Cases that failed in other branches as well (40 latest testcases)',
819819
'Dut Log URL',
820820
'Create Known Failure Case Jira',
821821
'Job URL',
822822
'Grafana URL',
823823
],
824-
row_attrs=['name', 'file', 'failure', 'dut_log_url', 'ci_job_url', 'ci_dashboard_url'],
824+
row_attrs=['name', 'app_path', 'failure', 'dut_log_url', 'ci_job_url', 'ci_dashboard_url'],
825825
value_functions=[
826826
(
827827
'Cases that failed in other branches as well (40 latest testcases)',
@@ -836,8 +836,8 @@ def get_failed_cases_report_parts(self) -> t.List[str]:
836836
known_failures_cases_table_section = self.create_table_section(
837837
title=self.report_titles_map['failed_known'],
838838
items=known_failures,
839-
headers=['Test Case', 'Test Script File Path', 'Failure Reason', 'Job URL', 'Grafana URL'],
840-
row_attrs=['name', 'file', 'failure', 'ci_job_url', 'ci_dashboard_url'],
839+
headers=['Test Case', 'Test App Path', 'Failure Reason', 'Job URL', 'Grafana URL'],
840+
row_attrs=['name', 'app_path', 'failure', 'ci_job_url', 'ci_dashboard_url'],
841841
)
842842
failed_cases_report_url = self.write_report_to_file(
843843
self.generate_html_report(
@@ -870,8 +870,8 @@ def get_skipped_cases_report_parts(self) -> t.List[str]:
870870
skipped_cases_table_section = self.create_table_section(
871871
title=self.report_titles_map['skipped'],
872872
items=skipped_test_cases,
873-
headers=['Test Case', 'Test Script File Path', 'Skipped Reason', 'Grafana URL'],
874-
row_attrs=['name', 'file', 'skipped', 'ci_dashboard_url'],
873+
headers=['Test Case', 'Test App Path', 'Skipped Reason', 'Grafana URL'],
874+
row_attrs=['name', 'app_path', 'skipped', 'ci_dashboard_url'],
875875
)
876876
skipped_cases_report_url = self.write_report_to_file(
877877
self.generate_html_report(''.join(skipped_cases_table_section)),
@@ -892,8 +892,8 @@ def get_succeeded_cases_report_parts(self) -> t.List[str]:
892892
succeeded_cases_table_section = self.create_table_section(
893893
title=self.report_titles_map['succeeded'],
894894
items=succeeded_test_cases,
895-
headers=['Test Case', 'Test Script File Path', 'Job URL', 'Grafana URL'],
896-
row_attrs=['name', 'file', 'ci_job_url', 'ci_dashboard_url'],
895+
headers=['Test Case', 'Test App Path', 'Job URL', 'Grafana URL'],
896+
row_attrs=['name', 'app_path', 'ci_job_url', 'ci_dashboard_url'],
897897
)
898898
succeeded_cases_report_url = self.write_report_to_file(
899899
self.generate_html_report(''.join(succeeded_cases_table_section)),

tools/ci/dynamic_pipelines/templates/.dynamic_jobs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
TARGET_SELECTOR: ""
5757
ENV_MARKERS: ""
5858
INSTALL_EXTRA_TOOLS: "xtensa-esp-elf-gdb riscv32-esp-elf-gdb openocd-esp32 esp-rom-elfs"
59-
PYTEST_EXTRA_FLAGS: "--dev-passwd ${ETHERNET_TEST_PASSWORD} --dev-user ${ETHERNET_TEST_USER} --capture=fd --verbosity=0"
59+
PYTEST_EXTRA_FLAGS: "--dev-passwd ${ETHERNET_TEST_PASSWORD} --dev-user ${ETHERNET_TEST_USER} --capture=fd --verbosity=0 --unity-test-report-mode merge"
6060
cache:
6161
# Usually do not need submodule-cache in target_test
6262
- key: pip-cache-${LATEST_GIT_TAG}

0 commit comments

Comments
 (0)