[IE TESTS] Add tag to the report (for identification scope) && add handling of exception in merge_xmls (#5660)

This commit is contained in:
Irina Efode 2021-05-17 23:08:42 +03:00 committed by GitHub
parent 71b87255ab
commit 4d6d088c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 6 deletions

View File

@ -28,7 +28,11 @@ def aggregate_test_results(results: ET.SubElement, xml_reports: list):
timestamp = None
for xml in xml_reports:
logger.info(f" Processing: {xml}")
xml_root = ET.parse(xml).getroot()
try:
xml_root = ET.parse(xml).getroot()
except ET.ParseError:
logger.error(f' {xml} is corrupted and skipped')
continue
xml_timestamp = xml_root.get("timestamp")
if (timestamp is None) or (xml_timestamp < timestamp):
timestamp = xml_timestamp

View File

@ -22,9 +22,11 @@ def parse_arguments():
report is be kept.
"""
out_help = "Path where to save html report"
report_tag = "Report tag"
parser.add_argument("--xml", help=xml_help, nargs="*", required=True)
parser.add_argument("--out", help=out_help, default="")
parser.add_argument("--report_tag", help=report_tag, default="")
return parser.parse_args()
@ -137,7 +139,7 @@ def collect_statistic(root: ET.Element):
return devices, results, general_pass_rate, pass_rate_avg, general_test_count, trusted_ops
def create_summary(summary_root: ET.Element, output_folder: str):
def create_summary(summary_root: ET.Element, output_folder: str, report_tag: str):
device_list, results, general_pass_rate, pass_rate_avg, general_test_count, trusted_ops = \
collect_statistic(summary_root)
@ -157,7 +159,7 @@ def create_summary(summary_root: ET.Element, output_folder: str):
res_summary = template.render(ordered_ops=op_list, devices=device_list, results=results, timestamp=timestamp,
general_pass_rate=general_pass_rate, pass_rate_avg=pass_rate_avg,
verified_operations=verified_operations, trusted_ops=trusted_ops,
general_test_count=general_test_count)
general_test_count=general_test_count, report_tag=report_tag)
report_path = os.path.join(output_folder, "report.html")
with open(report_path, "w") as f:
@ -168,4 +170,4 @@ def create_summary(summary_root: ET.Element, output_folder: str):
if __name__ == "__main__":
args = parse_arguments()
summary_root = merge_xmls(args.xml)
create_summary(summary_root, args.out)
create_summary(summary_root, args.out, args.report_tag)

View File

@ -26,8 +26,9 @@
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
crossorigin="anonymous"></script>
-->
<hr class="my-4">
<h2>Operations coverage summary {{ timestamp }}</h2>
<h2>Operations coverage summary: {{report_tag}} {{ timestamp }}</h2>
<hr class="my-4">
<table class="table table-hover" id="legend">
<thead>
@ -42,7 +43,7 @@
</thead>
</table>
<table class="table table-hover" id="report">
<thead style="position: sticky;top: 0">
<thead style="position: sticky; top: 0">
<tr>
<th class="table-primary" scope="col">Operation</th>
{% for d in devices -%}