From 7aee3e2105843d68dd1f03f7a5ccbf83abcb462f Mon Sep 17 00:00:00 2001 From: Swung0x48 Date: Wed, 23 Sep 2026 12:27:48 -0400 Subject: [PATCH] [ci] (P7): ph_latch_sites --table names each mechanics control by its gtest suite, not its file --- scripts/ci/ph_latch_sites.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/ci/ph_latch_sites.py b/scripts/ci/ph_latch_sites.py index 15bbd8f7..a5aac0ef 100644 --- a/scripts/ci/ph_latch_sites.py +++ b/scripts/ci/ph_latch_sites.py @@ -106,14 +106,20 @@ MECHANICS = [ ] +def case_suite(test_file, case): + """The gtest suite that owns `case` in `test_file`, or None when the file has no such case.""" + text = (WIRE_TESTS / test_file).read_text(encoding="utf-8") + found = re.search(r"\bTEST(?:_F|_P)?\(\s*(\w+)\s*,\s*" + case + r"\s*\)", text) + return found.group(1) if found else None + + def mechanics_failures(): failures = [] for source, what, check, cases in MECHANICS: if not re.search(check, source.read_text(encoding="utf-8"), re.DOTALL): failures.append(f"MECHANICS: {source.name} no longer has the check for `{what}`") for test_file, case in cases: - text = (WIRE_TESTS / test_file).read_text(encoding="utf-8") - if not re.search(r"\bTEST(?:_F|_P)?\(\s*\w+\s*,\s*" + case + r"\s*\)", text): + if case_suite(test_file, case) is None: failures.append(f"MECHANICS: {test_file} has no case {case} (the control for `{what}`)") return failures @@ -123,7 +129,8 @@ def print_mechanics(): print("| decline / close check | source | negative control(s) |") print("|---|---|---|") for source, what, _check, cases in MECHANICS: - print(f"| {what} | {source.name} | " + ", ".join(f"`{f.split('.')[0]}.{c}`" for f, c in cases) + " |") + print(f"| {what} | {source.name} | " + + ", ".join(f"`{case_suite(f, c)}.{c}` ({f})" for f, c in cases) + " |") LATCH_CALL = re.compile(r"(?