@@ -380,27 +380,33 @@ def set_dut_log_url(record_xml_attribute: t.Callable[[str, object], None], _pexp
380380 # Record the "dut_log_url" attribute in the XML report once test execution finished
381381 yield
382382
383- if not isinstance ( _pexpect_logfile , str ):
384- record_xml_attribute ( 'dut_log_url' , 'No log URL found' )
385- return
383+ def _attach_log_url_to_xml_attribute ( log_file_path : str ) -> str :
384+ if not isinstance ( log_file_path , str ):
385+ return 'No log URL found'
386386
387- ci_pages_url = os .getenv ('CI_PAGES_URL' )
388- logdir_pattern = re .compile (rf'({ DEFAULT_LOGDIR } /.*)' )
389- match = logdir_pattern .search (_pexpect_logfile )
387+ ci_pages_url = os .getenv ('CI_PAGES_URL' )
388+ logdir_pattern = re .compile (rf'({ DEFAULT_LOGDIR } /.*)' )
389+ match = logdir_pattern .search (log_file_path )
390390
391- if not match :
392- record_xml_attribute ('dut_log_url' , 'No log URL found' )
393- return
391+ if not match :
392+ return 'No log URL found'
394393
395- if not ci_pages_url :
396- record_xml_attribute ('dut_log_url' , _pexpect_logfile )
397- return
394+ if not ci_pages_url :
395+ return log_file_path
398396
399- job_id = os .getenv ('CI_JOB_ID' , '0' )
400- modified_ci_pages_url = ci_pages_url .replace ('esp-idf' , '-/esp-idf' )
401- log_url = f'{ modified_ci_pages_url } /-/jobs/{ job_id } /artifacts/{ match .group (1 )} '
397+ job_id = os .getenv ('CI_JOB_ID' , '0' )
398+ modified_ci_pages_url = ci_pages_url .replace ('esp-idf' , '-/esp-idf' )
399+ log_url = f'{ modified_ci_pages_url } /-/jobs/{ job_id } /artifacts/{ match .group (1 )} '
402400
403- record_xml_attribute ('dut_log_url' , log_url )
401+ return log_url
402+
403+ xml_attribute = []
404+ if isinstance (_pexpect_logfile , str ):
405+ xml_attribute .append (_attach_log_url_to_xml_attribute (_pexpect_logfile ))
406+ if isinstance (_pexpect_logfile , tuple ):
407+ for i , log_file in enumerate (_pexpect_logfile ):
408+ xml_attribute .append (_attach_log_url_to_xml_attribute (log_file ))
409+ record_xml_attribute ('dut_log_url' , ';' .join (xml_attribute ))
404410
405411
406412######################
0 commit comments