'
-
- successful_test_cases_table = PrettyTable()
- successful_test_cases_table.field_names = ['Test Case', 'Test Script File Path', 'Job URL']
- for tc in successful_test_cases:
- successful_test_cases_table.add_row([tc.name, tc.file, tc.ci_job_url])
-
- table_str += self.table_to_html_str(successful_test_cases_table)
+ table_str += self._create_table_for_test_cases(
+ test_cases=successful_test_cases,
+ headers=['Test Case', 'Test Script File Path', 'Job URL', 'Grafana URL'],
+ row_attrs=['name', 'file', 'ci_job_url', 'ci_dashboard_url'],
+ )
+ self.additional_info = (
+ '**Test Case Summary:**\n'
+ f'- **Failed Test Cases (Excludes Known Failure Cases):** {len(failed_test_cases)}\n'
+ f'- **Known Failures:** {len(known_failures)}\n'
+ f'- **Skipped Test Cases:** {len(skipped_test_cases)}\n'
+ f'- **Succeeded Test Cases:** {len(successful_test_cases)}\n\n'
+ f'Please check report below for more information.\n\n'
+ )
return self.generate_html_report(table_str)
diff --git a/tools/ci/dynamic_pipelines/scripts/generate_target_test_report.py b/tools/ci/dynamic_pipelines/scripts/generate_target_test_report.py
index cd736ad9f1..07a8952bcf 100644
--- a/tools/ci/dynamic_pipelines/scripts/generate_target_test_report.py
+++ b/tools/ci/dynamic_pipelines/scripts/generate_target_test_report.py
@@ -1,14 +1,12 @@
# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
-
import argparse
-import glob
import os
-import xml.etree.ElementTree as ET
import __init__ # noqa: F401 # inject the system path
-from dynamic_pipelines.models import TestCase
from dynamic_pipelines.report import TargetTestReportGenerator
+from dynamic_pipelines.utils import parse_testcases_from_filepattern
+
if __name__ == '__main__':
parser = argparse.ArgumentParser(
@@ -52,11 +50,6 @@ if __name__ == '__main__':
args = parser.parse_args()
- test_cases = []
- for f in glob.glob(args.junit_report_filepattern):
- root = ET.parse(f).getroot()
- for tc in root.findall('.//testcase'):
- test_cases.append(TestCase.from_test_case_node(tc))
-
+ test_cases = parse_testcases_from_filepattern(args.junit_report_filepattern)
report_generator = TargetTestReportGenerator(args.project_id, args.mr_iid, args.pipeline_id, test_cases=test_cases)
report_generator.post_report(args.job_id, args.commit_id)
diff --git a/tools/ci/dynamic_pipelines/templates/generate_target_test_report.yml b/tools/ci/dynamic_pipelines/templates/generate_target_test_report.yml
index 62cba4d77f..6559bc3502 100644
--- a/tools/ci/dynamic_pipelines/templates/generate_target_test_report.yml
+++ b/tools/ci/dynamic_pipelines/templates/generate_target_test_report.yml
@@ -7,4 +7,5 @@ generate_pytest_report:
paths:
- target_test_report.html
script:
+ - python tools/ci/get_known_failure_cases_file.py
- python tools/ci/dynamic_pipelines/scripts/generate_target_test_report.py
diff --git a/tools/ci/dynamic_pipelines/tests/__init__.py b/tools/ci/dynamic_pipelines/tests/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tools/ci/dynamic_pipelines/tests/test_report_generator/__init__.py b/tools/ci/dynamic_pipelines/tests/test_report_generator/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tools/ci/dynamic_pipelines/tests/test_report_generator/reports_sample_data/XUNIT_REPORT.xml b/tools/ci/dynamic_pipelines/tests/test_report_generator/reports_sample_data/XUNIT_REPORT.xml
new file mode 100644
index 0000000000..8f3737b75d
--- /dev/null
+++ b/tools/ci/dynamic_pipelines/tests/test_report_generator/reports_sample_data/XUNIT_REPORT.xml
@@ -0,0 +1,200 @@
+
+
+
+
+ conftest.py:74: in case_tester
+ yield CaseTester(dut, **kwargs)
+tools/ci/idf_unity_tester.py:202: in __init__
+ self._manager = Manager()
+/usr/lib/python3.9/multiprocessing/context.py:57: in Manager
+ m.start()
+/usr/lib/python3.9/multiprocessing/managers.py:557: in start
+ self._address = reader.recv()
+/usr/lib/python3.9/multiprocessing/connection.py:255: in recv
+ buf = self._recv_bytes()
+/usr/lib/python3.9/multiprocessing/connection.py:419: in _recv_bytes
+ buf = self._recv(4)
+/usr/lib/python3.9/multiprocessing/connection.py:388: in _recv
+ raise EOFError
+E EOFError
+
+
+ conftest.py:74: in case_tester
+ yield CaseTester(dut, **kwargs)
+tools/ci/idf_unity_tester.py:202: in __init__
+ self._manager = Manager()
+/usr/lib/python3.9/multiprocessing/context.py:57: in Manager
+ m.start()
+/usr/lib/python3.9/multiprocessing/managers.py:557: in start
+ self._address = reader.recv()
+/usr/lib/python3.9/multiprocessing/connection.py:255: in recv
+ buf = self._recv_bytes()
+/usr/lib/python3.9/multiprocessing/connection.py:419: in _recv_bytes
+ buf = self._recv(4)
+/usr/lib/python3.9/multiprocessing/connection.py:388: in _recv
+ raise EOFError
+E EOFError
+
+
+
+
+
+
+ /root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/plugin.py:1272: in pytest_runtest_call
+ self._raise_dut_failed_cases_if_exists(duts) # type: ignore
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/plugin.py:1207: in _raise_dut_failed_cases_if_exists
+ raise AssertionError('Unity test failed')
+E AssertionError: Unity test failed
+
+
+
+
+
+ /builds/espressif/esp-idf/tools/test_build_system/test_common.py:134: Linux does not support executing .exe files
+
+
+
+
+
+
+
+
+
+
+ /root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:76: in wrapper
+ index = func(self, pattern, *args, **kwargs)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:153: in expect_exact
+ return self.pexpect_proc.expect_exact(pattern, **kwargs)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/spawnbase.py:432: in expect_exact
+ return exp.expect_loop(timeout)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/expect.py:181: in expect_loop
+ return self.timeout(e)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/expect.py:144: in timeout
+ raise exc
+E pexpect.exceptions.TIMEOUT: <pytest_embedded.log.PexpectProcess object at 0x7f47b1ab46a0>
+E searcher: searcher_string:
+E 0: b'Press ENTER to see the list of tests'
+E <pytest_embedded.log.PexpectProcess object at 0x7f47b1ab46a0>
+E searcher: searcher_string:
+E 0: b'Press ENTER to see the list of tests'
+
+The above exception was the direct cause of the following exception:
+components/esp_timer/test_apps/pytest_esp_timer_ut.py:24: in test_esp_timer
+ dut.run_all_single_board_cases(timeout=120)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded_idf/unity_tester.py:435: in run_all_single_board_cases
+ for case in self.test_menu:
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded_idf/unity_tester.py:243: in test_menu
+ self._test_menu = self._parse_test_menu()
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded_idf/unity_tester.py:124: in _parse_test_menu
+ self.expect_exact(ready_line)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:83: in wrapper
+ raise e.__class__(debug_str) from e
+E pexpect.exceptions.TIMEOUT: Not found "Press ENTER to see the list of tests"
+E Bytes in current buffer (color code eliminated): ce710,len:0x2afc entry 0x403cc710
+E Please check the full log here: /builds/espressif/esp-idf/pytest_embedded/2024-05-17_17-50-04/esp32c3.release.test_esp_timer/dut.txt
+
+
+ /root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:76: in wrapper
+ index = func(self, pattern, *args, **kwargs)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:131: in expect
+ return self.pexpect_proc.expect(pattern, **kwargs)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/spawnbase.py:354: in expect
+ return self.expect_list(compiled_pattern_list,
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/spawnbase.py:383: in expect_list
+ return exp.expect_loop(timeout)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/expect.py:181: in expect_loop
+ return self.timeout(e)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/expect.py:144: in timeout
+ raise exc
+E pexpect.exceptions.TIMEOUT: <pytest_embedded.log.PexpectProcess object at 0x7f47af653b80>
+E searcher: searcher_re:
+E 0: re.compile(b'^[-]+\\s*(\\d+) Tests (\\d+) Failures (\\d+) Ignored\\s*(?P<result>OK|FAIL)')
+E <pytest_embedded.log.PexpectProcess object at 0x7f47af653b80>
+E searcher: searcher_re:
+E 0: re.compile(b'^[-]+\\s*(\\d+) Tests (\\d+) Failures (\\d+) Ignored\\s*(?P<result>OK|FAIL)')
+
+The above exception was the direct cause of the following exception:
+components/wear_levelling/test_apps/pytest_wear_levelling.py:18: in test_wear_levelling
+ dut.expect_unity_test_output()
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:180: in expect_unity_test_output
+ self.expect(UNITY_SUMMARY_LINE_REGEX, timeout=timeout)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:83: in wrapper
+ raise e.__class__(debug_str) from e
+E pexpect.exceptions.TIMEOUT: Not found "re.compile(b'^[-]+\\s*(\\d+) Tests (\\d+) Failures (\\d+) Ignored\\s*(?P<result>OK|FAIL)', re.MULTILINE)"
+E Bytes in current buffer (color code eliminated): Serial port /dev/ttyUSB16 Connecting.... Connecting.... esptool.py v4.7.0 Found 1 serial ports Chip is ESP32-C3 (QFN32) (revision v0.3) Features: WiFi, BLE, Embedded Flash 4MB... (total 6673 bytes)
+E Please check the full log here: /builds/espressif/esp-idf/pytest_embedded/2024-05-17_17-50-04/esp32c3.512safe.test_wear_levelling/dut.txt
+
+
+ /root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:76: in wrapper
+ index = func(self, pattern, *args, **kwargs)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:131: in expect
+ return self.pexpect_proc.expect(pattern, **kwargs)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/spawnbase.py:354: in expect
+ return self.expect_list(compiled_pattern_list,
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/spawnbase.py:383: in expect_list
+ return exp.expect_loop(timeout)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/expect.py:181: in expect_loop
+ return self.timeout(e)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/expect.py:144: in timeout
+ raise exc
+E pexpect.exceptions.TIMEOUT: <pytest_embedded.log.PexpectProcess object at 0x7f47afc540d0>
+E searcher: searcher_re:
+E 0: re.compile(b'^[-]+\\s*(\\d+) Tests (\\d+) Failures (\\d+) Ignored\\s*(?P<result>OK|FAIL)')
+E <pytest_embedded.log.PexpectProcess object at 0x7f47afc540d0>
+E searcher: searcher_re:
+E 0: re.compile(b'^[-]+\\s*(\\d+) Tests (\\d+) Failures (\\d+) Ignored\\s*(?P<result>OK|FAIL)')
+
+The above exception was the direct cause of the following exception:
+components/wear_levelling/test_apps/pytest_wear_levelling.py:18: in test_wear_levelling
+ dut.expect_unity_test_output()
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:180: in expect_unity_test_output
+ self.expect(UNITY_SUMMARY_LINE_REGEX, timeout=timeout)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:83: in wrapper
+ raise e.__class__(debug_str) from e
+E pexpect.exceptions.TIMEOUT: Not found "re.compile(b'^[-]+\\s*(\\d+) Tests (\\d+) Failures (\\d+) Ignored\\s*(?P<result>OK|FAIL)', re.MULTILINE)"
+E Bytes in current buffer (color code eliminated): Serial port /dev/ttyUSB16 Connecting.... Connecting.... esptool.py v4.7.0 Found 1 serial ports Chip is ESP32-C3 (QFN32) (revision v0.3) Features: WiFi, BLE, Embedded Flash 4MB... (total 24528 bytes)
+E Please check the full log here: /builds/espressif/esp-idf/pytest_embedded/2024-05-17_17-50-04/esp32c3.release.test_wear_levelling/dut.txt
+
+
+ /root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:76: in wrapper
+ index = func(self, pattern, *args, **kwargs)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:153: in expect_exact
+ return self.pexpect_proc.expect_exact(pattern, **kwargs)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/spawnbase.py:432: in expect_exact
+ return exp.expect_loop(timeout)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/expect.py:181: in expect_loop
+ return self.timeout(e)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pexpect/expect.py:144: in timeout
+ raise exc
+E pexpect.exceptions.TIMEOUT: <pytest_embedded.log.PexpectProcess object at 0x7f47afc54df0>
+E searcher: searcher_string:
+E 0: b'Press ENTER to see the list of tests'
+E <pytest_embedded.log.PexpectProcess object at 0x7f47afc54df0>
+E searcher: searcher_string:
+E 0: b'Press ENTER to see the list of tests'
+
+The above exception was the direct cause of the following exception:
+components/wpa_supplicant/test_apps/pytest_wpa_supplicant_ut.py:17: in test_wpa_supplicant_ut
+ dut.run_all_single_board_cases()
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded_idf/unity_tester.py:435: in run_all_single_board_cases
+ for case in self.test_menu:
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded_idf/unity_tester.py:243: in test_menu
+ self._test_menu = self._parse_test_menu()
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded_idf/unity_tester.py:124: in _parse_test_menu
+ self.expect_exact(ready_line)
+/root/.espressif/python_env/idf5.2_py3.9_env/lib/python3.9/site-packages/pytest_embedded/dut.py:83: in wrapper
+ raise e.__class__(debug_str) from e
+E pexpect.exceptions.TIMEOUT: Not found "Press ENTER to see the list of tests"
+E Bytes in current buffer (color code eliminated): 0 d4 000 00x0000 x0000x00 000000 0
+E Please check the full log here: /builds/espressif/esp-idf/pytest_embedded/2024-05-17_17-50-04/esp32c3.default.test_wpa_supplicant_ut/dut.txt
+
+
+
diff --git a/tools/ci/dynamic_pipelines/tests/test_report_generator/reports_sample_data/expected_target_test_report.html b/tools/ci/dynamic_pipelines/tests/test_report_generator/reports_sample_data/expected_target_test_report.html
new file mode 100644
index 0000000000..b4c143879b
--- /dev/null
+++ b/tools/ci/dynamic_pipelines/tests/test_report_generator/reports_sample_data/expected_target_test_report.html
@@ -0,0 +1,178 @@
+
+
+
+
+ Test Report
+
+
+
+
+
+
+
pexpect.exceptions.TIMEOUT: Not found "re.compile(b'^[-]+\\s*(\\d+) Tests (\\d+) Failures (\\d+) Ignored\\s*(?POK|FAIL)', re.MULTILINE)" Bytes in current buffer (color code eliminated): Serial port /dev/ttyUSB16 Connecting.... Connecting.... esptool.py v4.7.0 Found 1 serial ports Chip is ESP32-C3 (QFN32) (revision v0.3) Features: WiFi, BLE, Embedded Flash 4MB... (total 24528 bytes) Please check the full log here: /builds/espressif/esp-idf/pytest_embedded/2024-05-17_17-50-04/esp32c3.release.test_wear_levelling/dut.txt
pexpect.exceptions.TIMEOUT: Not found "Press ENTER to see the list of tests" Bytes in current buffer (color code eliminated): ce710,len:0x2afc entry 0x403cc710 Please check the full log here: /builds/espressif/esp-idf/pytest_embedded/2024-05-17_17-50-04/esp32c3.release.test_esp_timer/dut.txt
pexpect.exceptions.TIMEOUT: Not found "re.compile(b'^[-]+\\s*(\\d+) Tests (\\d+) Failures (\\d+) Ignored\\s*(?POK|FAIL)', re.MULTILINE)" Bytes in current buffer (color code eliminated): Serial port /dev/ttyUSB16 Connecting.... Connecting.... esptool.py v4.7.0 Found 1 serial ports Chip is ESP32-C3 (QFN32) (revision v0.3) Features: WiFi, BLE, Embedded Flash 4MB... (total 6673 bytes) Please check the full log here: /builds/espressif/esp-idf/pytest_embedded/2024-05-17_17-50-04/esp32c3.512safe.test_wear_levelling/dut.txt
pexpect.exceptions.TIMEOUT: Not found "Press ENTER to see the list of tests" Bytes in current buffer (color code eliminated): 0 d4 000 00x0000 x0000x00 000000 0 Please check the full log here: /builds/espressif/esp-idf/pytest_embedded/2024-05-17_17-50-04/esp32c3.default.test_wpa_supplicant_ut/dut.txt