Update merge script to work with outdated reports (#16078)

* Update merge script to work with outdated xml

* change report name
This commit is contained in:
Irina Efode 2023-03-03 15:02:04 +04:00 committed by GitHub
parent 35dacb370a
commit 3b6bb06f1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 6 deletions

View File

@ -34,8 +34,18 @@ def parse_arguments():
return parser.parse_args()
def update_rel_values(xml_node: SubElement):
if not "relative_all" in xml_node.attrib:
test_cnt = int(xml_node.attrib.get("passed")) + int(xml_node.attrib.get("failed")) + int(xml_node.attrib.get("skipped")) + \
int(xml_node.attrib.get("crashed")) + int(xml_node.attrib.get("hanged"))
xml_node.set("relative_all", str(test_cnt))
if not "relative_passed" in xml_node.attrib:
xml_node.set("relative_passed", xml_node.attrib.get("passed"))
def update_result_node(xml_node: SubElement, aggregated_res: SubElement):
update_rel_values(aggregated_res)
update_rel_values(xml_node)
for attr_name in xml_node.attrib:
if attr_name == "passrate" or attr_name == "relative_passrate":
continue
@ -47,8 +57,6 @@ def update_result_node(xml_node: SubElement, aggregated_res: SubElement):
continue
xml_value = float(xml_node.attrib.get(attr_name)) if "relative_" in attr_name else int(xml_node.attrib.get(attr_name))
aggregated_value = float(aggregated_res.attrib.get(attr_name)) if "relative_" in attr_name else int(aggregated_res.attrib.get(attr_name))
# if attr_name == "crashed" and xml_value > 0:
# print("f")
aggregated_res.set(attr_name, str(xml_value + aggregated_value))
@ -74,6 +82,7 @@ def aggregate_test_results(aggregated_results: SubElement, xml_reports: list, re
for xml_results_entry in xml_device_entry:
aggregated_results_entry = aggregated_device_results.find(xml_results_entry.tag)
if aggregated_results_entry is None:
update_rel_values(xml_results_entry)
aggregated_device_results.append(xml_results_entry)
continue
if report_type == "OP":

View File

@ -171,12 +171,12 @@ class Conformance:
conformance.run()
conformance.postprocess_logs()
final_report_name = f'report_{self._type}'
final_report_name = f'report_{self._type.lower()}'
# API Conformance contains both report type
merge_xml([parallel_report_dir], report_dir, final_report_name, self._type)
if self._type == constants.API_CONFORMANCE:
final_op_report_name = f'report_{constants.OP_CONFORMANCE}'
merge_xml([parallel_report_dir], report_dir, final_op_report_name, constants.OP_CONFORMANCE)
final_op_report_name = f'report_{constants.OP_CONFORMANCE.lower()}'
merge_xml([parallel_report_dir], report_dir, final_op_report_name, constants.OP_CONFORMANCE.lower())
logger.info(f"Conformance is successful. XML reportwas saved to {report_dir}")
return (os.path.join(report_dir, final_report_name + ".xml"), report_dir)

View File

@ -31,4 +31,4 @@ DEBUG_DIR = "Debug"
RELEASE_DIR = "Release"
OP_CONFORMANCE = "OP"
API_CONFORMANCE = "API"
API_CONFORMANCE = "API"