From a2111688faee3540aee14e1d1e4f806507beeb5c Mon Sep 17 00:00:00 2001 From: hmodymac8-droid <250235878+hmodymac8-droid@users.noreply.github.com> Date: Tue, 24 Nov 2026 04:02:43 +0300 Subject: [PATCH 1/3] PR checks: a runtime file whose name only contains "tests" still needs a regression run runtime() treated any path under crates/xcl/src containing "/tests" or ending in "tests.rs" as a test file, so a runtime module such as requests.rs, contests.rs or hle/testsupport/mod.rs would have skipped the regression run. Only a tests.rs or *_tests.rs module, or a file under a tests/ directory, counts as test code now. No file in the tree is classified differently. Adds scripts/pr_check_tests.py. Co-Authored-By: Claude Opus 5.5 --- scripts/pr_check.py | 8 ++++++- scripts/pr_check_tests.py | 44 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 scripts/pr_check_tests.py diff --git a/scripts/pr_check.py b/scripts/pr_check.py index e70cab9b2..6b3262f2f 100644 --- a/scripts/pr_check.py +++ b/scripts/pr_check.py @@ -44,7 +44,13 @@ def number(s): def runtime(path): - return path.startswith("crates/xcl/src/") and "/tests" not in path and not path.endswith("tests.rs") + """Whether `path` is runtime code (built into xcl.exe), not one of its test files: a `tests.rs` + or `*_tests.rs` module, or a file under a `tests/` directory. Only whole names count, so a + runtime module such as `requests.rs` or `hle/testsupport/mod.rs` still needs a regression run.""" + if not path.startswith("crates/xcl/src/"): + return False + *dirs, name = path[len("crates/xcl/src/"):].split("/") + return not ("tests" in dirs or name == "tests.rs" or name.endswith("_tests.rs")) def check(body, head, files, is_main_ancestor, *, test_only=False): diff --git a/scripts/pr_check_tests.py b/scripts/pr_check_tests.py new file mode 100644 index 000000000..1b8e77ce8 --- /dev/null +++ b/scripts/pr_check_tests.py @@ -0,0 +1,44 @@ +"""Tests for scripts/pr_check.py: python scripts/pr_check_tests.py""" +import os, sys, unittest + +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) +import pr_check # noqa: E402 + +BODY = "**Tested**\n- ran\n\n**Not tested**\n- nothing\n\n**AI use**\n- none\n" + + +def files(*paths): + return [(p, "modified", False, lambda: 100) for p in paths] + + +class RuntimePaths(unittest.TestCase): + def test_test_files_are_not_runtime(self): + for path in ("crates/xcl/src/gpu/recomp/tests.rs", "crates/xcl/src/gpu/adapter_tests.rs", + "crates/xcl/src/gpu/agility_tests.rs", "crates/xcl/src/hle/tests/vram.rs"): + with self.subTest(path=path): + self.assertFalse(pr_check.runtime(path)) + + def test_runtime_files_are_runtime(self): + for path in ("crates/xcl/src/gpu/rdna2.rs", "crates/xcl/src/hle/d3d12x/vram.rs", + # names that only contain "tests" are runtime modules, not test files + "crates/xcl/src/net/requests.rs", "crates/xcl/src/hle/contests.rs", + "crates/xcl/src/hle/testsupport/mod.rs", "crates/xcl/src/gpu/tests_layout.rs"): + with self.subTest(path=path): + self.assertTrue(pr_check.runtime(path)) + + def test_outside_the_runtime_crate(self): + for path in ("README.md", "scripts/pr_check.py", "tests/testtitle/src/main.rs"): + with self.subTest(path=path): + self.assertFalse(pr_check.runtime(path)) + + def test_a_runtime_file_named_like_a_test_still_needs_a_regression_run(self): + problems = pr_check.check(BODY, "0123456789ab", files("crates/xcl/src/net/requests.rs"), lambda sha: True) + self.assertTrue(any("Regression run" in p for p in problems), problems) + + def test_a_test_only_pr_needs_no_regression_run(self): + problems = pr_check.check(BODY, "0123456789ab", files("crates/xcl/src/gpu/recomp/tests.rs"), lambda sha: True) + self.assertEqual(problems, []) + + +if __name__ == "__main__": + unittest.main() From 0b4628e3eb87dd2dd70c0fb7e85b77a1c855934b Mon Sep 17 00:00:00 2001 From: hmodymac8-droid <250235878+hmodymac8-droid@users.noreply.github.com> Date: Tue, 24 Nov 2026 05:03:58 +0300 Subject: [PATCH 2/3] PR checks: use contests.rs, not requests.rs, as the example (main already counts requests.rs as runtime) Review by Kalmarv on #497. Co-Authored-By: Claude Opus 5.5 --- scripts/pr_check.py | 2 +- scripts/pr_check_tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pr_check.py b/scripts/pr_check.py index 6b3262f2f..9cebcafd6 100644 --- a/scripts/pr_check.py +++ b/scripts/pr_check.py @@ -46,7 +46,7 @@ def number(s): def runtime(path): """Whether `path` is runtime code (built into xcl.exe), not one of its test files: a `tests.rs` or `*_tests.rs` module, or a file under a `tests/` directory. Only whole names count, so a - runtime module such as `requests.rs` or `hle/testsupport/mod.rs` still needs a regression run.""" + runtime module such as `contests.rs` or `hle/testsupport/mod.rs` still needs a regression run.""" if not path.startswith("crates/xcl/src/"): return False *dirs, name = path[len("crates/xcl/src/"):].split("/") diff --git a/scripts/pr_check_tests.py b/scripts/pr_check_tests.py index 1b8e77ce8..487c917bc 100644 --- a/scripts/pr_check_tests.py +++ b/scripts/pr_check_tests.py @@ -32,7 +32,7 @@ def test_outside_the_runtime_crate(self): self.assertFalse(pr_check.runtime(path)) def test_a_runtime_file_named_like_a_test_still_needs_a_regression_run(self): - problems = pr_check.check(BODY, "0123456789ab", files("crates/xcl/src/net/requests.rs"), lambda sha: True) + problems = pr_check.check(BODY, "0123456789ab", files("crates/xcl/src/hle/contests.rs"), lambda sha: True) self.assertTrue(any("Regression run" in p for p in problems), problems) def test_a_test_only_pr_needs_no_regression_run(self): From 507c573ecf9ccdfba2a2fbdfb785ba552dad1657 Mon Sep 17 00:00:00 2001 From: hmodymac8-droid <250235878+hmodymac8-droid@users.noreply.github.com> Date: Tue, 24 Nov 2026 06:03:21 +0300 Subject: [PATCH 3/3] PR checks: the runtime-path tests go into scripts/test_pr_check.py (#507) Co-Authored-By: Claude Opus 5.5 --- scripts/pr_check_tests.py | 44 --------------------------------------- scripts/test_pr_check.py | 25 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 45 deletions(-) delete mode 100644 scripts/pr_check_tests.py diff --git a/scripts/pr_check_tests.py b/scripts/pr_check_tests.py deleted file mode 100644 index 487c917bc..000000000 --- a/scripts/pr_check_tests.py +++ /dev/null @@ -1,44 +0,0 @@ -"""Tests for scripts/pr_check.py: python scripts/pr_check_tests.py""" -import os, sys, unittest - -sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) -import pr_check # noqa: E402 - -BODY = "**Tested**\n- ran\n\n**Not tested**\n- nothing\n\n**AI use**\n- none\n" - - -def files(*paths): - return [(p, "modified", False, lambda: 100) for p in paths] - - -class RuntimePaths(unittest.TestCase): - def test_test_files_are_not_runtime(self): - for path in ("crates/xcl/src/gpu/recomp/tests.rs", "crates/xcl/src/gpu/adapter_tests.rs", - "crates/xcl/src/gpu/agility_tests.rs", "crates/xcl/src/hle/tests/vram.rs"): - with self.subTest(path=path): - self.assertFalse(pr_check.runtime(path)) - - def test_runtime_files_are_runtime(self): - for path in ("crates/xcl/src/gpu/rdna2.rs", "crates/xcl/src/hle/d3d12x/vram.rs", - # names that only contain "tests" are runtime modules, not test files - "crates/xcl/src/net/requests.rs", "crates/xcl/src/hle/contests.rs", - "crates/xcl/src/hle/testsupport/mod.rs", "crates/xcl/src/gpu/tests_layout.rs"): - with self.subTest(path=path): - self.assertTrue(pr_check.runtime(path)) - - def test_outside_the_runtime_crate(self): - for path in ("README.md", "scripts/pr_check.py", "tests/testtitle/src/main.rs"): - with self.subTest(path=path): - self.assertFalse(pr_check.runtime(path)) - - def test_a_runtime_file_named_like_a_test_still_needs_a_regression_run(self): - problems = pr_check.check(BODY, "0123456789ab", files("crates/xcl/src/hle/contests.rs"), lambda sha: True) - self.assertTrue(any("Regression run" in p for p in problems), problems) - - def test_a_test_only_pr_needs_no_regression_run(self): - problems = pr_check.check(BODY, "0123456789ab", files("crates/xcl/src/gpu/recomp/tests.rs"), lambda sha: True) - self.assertEqual(problems, []) - - -if __name__ == "__main__": - unittest.main() diff --git a/scripts/test_pr_check.py b/scripts/test_pr_check.py index f93667f53..2d6de1395 100644 --- a/scripts/test_pr_check.py +++ b/scripts/test_pr_check.py @@ -1,6 +1,6 @@ import unittest -from pr_check import check +from pr_check import check, runtime HEAD = "1234567890abcdef" @@ -11,6 +11,29 @@ def changed(path, binary=False): return (path, "modified", binary, lambda: 10) +class RuntimePathTests(unittest.TestCase): + def test_test_files_are_not_runtime(self): + for path in ("crates/xcl/src/gpu/recomp/tests.rs", "crates/xcl/src/gpu/adapter_tests.rs", + "crates/xcl/src/gpu/agility_tests.rs", "crates/xcl/src/hle/tests/vram.rs"): + with self.subTest(path=path): + self.assertFalse(runtime(path)) + + def test_names_that_only_contain_tests_are_runtime(self): + for path in ("crates/xcl/src/gpu/rdna2.rs", "crates/xcl/src/net/requests.rs", "crates/xcl/src/hle/contests.rs", + "crates/xcl/src/hle/testsupport/mod.rs", "crates/xcl/src/gpu/tests_layout.rs"): + with self.subTest(path=path): + self.assertTrue(runtime(path)) + + def test_outside_the_runtime_crate(self): + for path in ("README.md", "scripts/pr_check.py", "tests/testtitle/src/main.rs", "crates/xcl/tests/e2e.rs"): + with self.subTest(path=path): + self.assertFalse(runtime(path)) + + def test_a_runtime_file_named_like_a_test_still_needs_a_regression_run(self): + problems = check(BODY, HEAD, [changed("crates/xcl/src/hle/contests.rs")], lambda _: False) + self.assertTrue(problems and all("Regression run" in problem for problem in problems), problems) + + class TestOnlyApprovalTests(unittest.TestCase): def test_runtime_path_requires_smoke_until_approved(self): files = [changed("crates/xcl/src/hle/d3d12x/vram.rs")]