in treeherder/intermittents_commenter/commenter.py [0:0]
def get_test_manifest(self, bug_summaries):
all_tests = self.get_tests_from_manifests()
tv_strings = [
" TV ",
" TV-nofis ",
"[TV]",
" TVW ",
"[TVW]",
" TC ",
"[TC]",
" TCW ",
"[TCW]",
]
test_file_extensions = [
"html",
"html (finished)",
"js",
"js (finished)",
"py",
"htm",
"xht",
"svg",
"mp4",
]
for bug_summary_dict in bug_summaries:
summary = bug_summary_dict["summary"]
# ensure format we want
if "| single tracking bug" not in summary:
continue
# ignore chrome://, file://, resource://, http[s]://, etc.
if "://" in summary:
continue
# ignore test-verify as these run only on demand when the specific test is modified
if any(k for k in tv_strings if k.lower() in summary.lower()):
continue
# now parse and try to find file in list of tests
if any(k for k in test_file_extensions if f"{k} | single" in summary):
if " (finished)" in summary:
summary = summary.replace(" (finished)", "")
# get <test_name> from: "TEST-UNEXPECTED-FAIL | <test_name> | single tracking bug"
# TODO: fix reftest
test_name = summary.split("|")[-2].strip()
if " == " in test_name or " != " in test_name:
test_name = test_name.split(" ")[0]
else:
test_name = test_name.split(" ")[-1]
# comm/ is thunderbird, not in mozilla-central repo
# "-ref" is related to a reftest reference file, not what we want to target
# if no <path>/<filename>, then we won't be able to find in repo, ignore
if test_name.startswith("comm/") or "-ref" in test_name or "/" not in test_name:
continue
# handle known WPT mapping
if test_name.startswith("/") or test_name.startswith("mozilla/tests"):
test_name = self.fix_wpt_name(test_name)
if test_name not in all_tests:
# try reftest:
if f"layout/reftests/{test_name}" in all_tests:
test_name = f"layout/reftests/{test_name}"
else:
# unknown test
# TODO: we get here for a few reasons:
# 1) test has moved in the source tree
# 2) test has typo in summary
# 3) test has been deleted from the source tree
# 4) sometimes test was deleted but is valid on beta
continue
# matching test- we can access manifest
manifest = all_tests[test_name]
return manifest[0]
return None