Created
April 8, 2022 17:56
-
-
Save driazati/f636700cd68b5717350c107a0eaaee4e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euxo pipefail | |
curl -L "$1" > main_report.xml | |
curl -L "$2" > shard_report.xml | |
python list_tests.py --no-details --file main_report.xml | sort > main.log | |
python list_tests.py --no-details --file shard_report.xml | sort > shard.log | |
git add main.log -f | |
mv shard.log main.log | |
git diff main.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from pathlib import Path | |
def lstrip(s: str, prefix: str) -> str: | |
if s.startswith(prefix): | |
s = s[len(prefix) :] | |
return s | |
def classname_to_file(classname: str) -> str: | |
classname = lstrip(classname, "cython.") | |
classname = lstrip(classname, "ctypes.") | |
return classname.replace(".", "/") + ".py" | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser( | |
description="Wrap TVM CI scripts and output helpful information on failures" | |
) | |
parser.add_argument("--file", default="report.xml", help="xml report file") | |
parser.add_argument( | |
"--no-details", action="store_true", help="skip test case details" | |
) | |
args, other = parser.parse_known_args() | |
import untangle | |
file_path = Path(args.file) | |
if not file_path.exists(): | |
raise RuntimeError(f"'{file_path}' file doesn't exist") | |
obj = untangle.parse(str(file_path)) | |
tests = [] | |
for suite in obj.testResult.suite: | |
for case in suite.case: | |
if case.status.cdata == "SKIPPED": | |
continue | |
block = " / ".join(reversed([x.cdata for x in suite.enclosingBlockName])) | |
node_id = classname_to_file(case.className.cdata) + "::" + case.name.cdata | |
if not args.no_details: | |
node_id += " " + case.status.cdata + " " + block | |
tests.append(node_id) | |
for nodeid in tests: | |
print(nodeid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment