mirror of
https://github.com/espressif/esp-idf.git
synced 2026-04-27 19:13:21 +00:00
ci: attach_log_url for multi dut tests
This commit is contained in:
+22
-16
@@ -366,27 +366,33 @@ def set_dut_log_url(record_xml_attribute: t.Callable[[str, object], None], _pexp
|
|||||||
# Record the "dut_log_url" attribute in the XML report once test execution finished
|
# Record the "dut_log_url" attribute in the XML report once test execution finished
|
||||||
yield
|
yield
|
||||||
|
|
||||||
if not isinstance(_pexpect_logfile, str):
|
def _attach_log_url_to_xml_attribute(log_file_path: str) -> str:
|
||||||
record_xml_attribute('dut_log_url', 'No log URL found')
|
if not isinstance(log_file_path, str):
|
||||||
return
|
return 'No log URL found'
|
||||||
|
|
||||||
ci_pages_url = os.getenv('CI_PAGES_URL')
|
ci_pages_url = os.getenv('CI_PAGES_URL')
|
||||||
logdir_pattern = re.compile(rf'({DEFAULT_LOGDIR}/.*)')
|
logdir_pattern = re.compile(rf'({DEFAULT_LOGDIR}/.*)')
|
||||||
match = logdir_pattern.search(_pexpect_logfile)
|
match = logdir_pattern.search(log_file_path)
|
||||||
|
|
||||||
if not match:
|
if not match:
|
||||||
record_xml_attribute('dut_log_url', 'No log URL found')
|
return 'No log URL found'
|
||||||
return
|
|
||||||
|
|
||||||
if not ci_pages_url:
|
if not ci_pages_url:
|
||||||
record_xml_attribute('dut_log_url', _pexpect_logfile)
|
return log_file_path
|
||||||
return
|
|
||||||
|
|
||||||
job_id = os.getenv('CI_JOB_ID', '0')
|
job_id = os.getenv('CI_JOB_ID', '0')
|
||||||
modified_ci_pages_url = ci_pages_url.replace('esp-idf', '-/esp-idf')
|
modified_ci_pages_url = ci_pages_url.replace('esp-idf', '-/esp-idf')
|
||||||
log_url = f'{modified_ci_pages_url}/-/jobs/{job_id}/artifacts/{match.group(1)}'
|
log_url = f'{modified_ci_pages_url}/-/jobs/{job_id}/artifacts/{match.group(1)}'
|
||||||
|
|
||||||
record_xml_attribute('dut_log_url', log_url)
|
return log_url
|
||||||
|
|
||||||
|
xml_attribute = []
|
||||||
|
if isinstance(_pexpect_logfile, str):
|
||||||
|
xml_attribute.append(_attach_log_url_to_xml_attribute(_pexpect_logfile))
|
||||||
|
if isinstance(_pexpect_logfile, tuple):
|
||||||
|
for i, log_file in enumerate(_pexpect_logfile):
|
||||||
|
xml_attribute.append(_attach_log_url_to_xml_attribute(log_file))
|
||||||
|
record_xml_attribute('dut_log_url', ';'.join(xml_attribute))
|
||||||
|
|
||||||
|
|
||||||
######################
|
######################
|
||||||
|
|||||||
Reference in New Issue
Block a user