in utils/appverifier_xml.py [0:0]
def parseXML(filepath, dump_xml_on_error):
xml_is_app_verifier = False
app_verifier_entries = []
print("Looking for AppVerifier XML file...")
xml_tree = ElementTree.parse(filepath)
# Go through every element in the XML tree
for elem in xml_tree.iter():
if (elem.tag == s_AppVerifier_LogText):
xml_is_app_verifier = True
elif (elem.tag == s_AppVerifier_EntryText):
app_verifier_entries.append(elem)
# If the XML does not have any AppVerifier data, then something went wrong!
if (xml_is_app_verifier == False):
print("ERROR: XML File from AppVerifier does not include a AppVerifier session!")
return -1
# If we have AppVerifier entries, then a test or tests failed, so process the data,
# print it, and then return with an error to stop the GitHub action from passing
if (len(app_verifier_entries) > 0):
print("WARNING: AppVerifier entries found:")
severity_error_found = False
for entry in app_verifier_entries:
element_time = entry.attrib.get("Time", "UNKNOWN")
element_layer_name = entry.attrib.get("LayerName", "UNKNOWN")
element_code = entry.attrib.get("StopCode", "UNKNOWN")
element_severity = entry.attrib.get("Severity", "UNKNOWN")
print_red = False
if (element_severity in s_AppVerifier_ErrorSeverities):
severity_error_found = True
print_red = True
if (print_red):
print(
f"ERROR: [{element_time}] {element_severity.upper()} - Test: {element_layer_name} - Stop Code: {element_code}")
else:
print(
f"[{element_time}] {element_severity.upper()} - Test: {element_layer_name} - Stop Code: {element_code}")
print(f"\t{getErrorCodeMeaning(element_layer_name, element_code)}")
print(
"\nNOTE: The error codes and information provided are just guesses based on the error code.\n"
"\tRun AppVerifier locally and use WinDBG combined with the AppVerifier help to discover more "
"about the error from its error code and how to debug it.")
if (severity_error_found == True and dump_xml_on_error != None):
if (dump_xml_on_error == True):
print("\nERROR: Raw XML output for errors found:\n")
for entry in app_verifier_entries:
print(ElementTree.tostring(
entry, encoding="unicode"))
if (severity_error_found == True):
print(
"\nERROR: Failed due to AppVerifier finding entries marked as severe")
return -1
else:
print("SUCCESS: AppVerifier entries were not marked as severe")
return 0
else:
print("SUCCESS: No AppVerifier entries found! AppVerifier ran successfully and did not generate any entries")
return 0