From c95a7baae4a83cda0ee11f9787330999e40a6b54 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 21 Oct 2026 06:26:45 +0000 Subject: [PATCH] test_projected_pairs: regenerate pinned build sources from NUMERICAL_REVISION kernels The pinned BUILD_SOURCES are the a135252 qualification build inputs. generate_config hashes the whole kernel snapshot, so after K1/K2 the working-tree kernels (legitimately) no longer reproduce them. The test now archives src/CelerisLab/lbm/kernels at NUMERICAL_REVISION and points compiler_v2._KERNEL_DIR there; config headers are still rendered by today's compiler. BUILD_SOURCES and the equality assertion are unchanged; each size is a subTest; a missing NUMERICAL_REVISION fails (no skip). Co-Authored-By: Claude Opus 5.5 --- .../taylor_green/test_projected_pairs.py | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/tests/validation/taylor_green/test_projected_pairs.py b/tests/validation/taylor_green/test_projected_pairs.py index 50b9f8b..b1e9f8f 100644 --- a/tests/validation/taylor_green/test_projected_pairs.py +++ b/tests/validation/taylor_green/test_projected_pairs.py @@ -249,19 +249,35 @@ class ProjectedPairsTests(unittest.TestCase): self.assertFalse(assess(incomplete)["comparisons"][3]["passed"]) def test_pinned_build_sources_match_host_generated_inputs(self): + """The pinned fingerprints are what today's compiler generates from the qualified + NUMERICAL_REVISION kernels; the current kernels may legitimately differ.""" + import tarfile from CelerisLab.cuda import compiler_v2 - for size in (128, 256): - cfg = replace(run_case.config(size, 100), nx=10, ny=10) - cfg.validate() - root = compiler_v2.generate_config(cfg) - try: - actual = json.loads((Path(root) / ".celeris-build").read_text()) - expected = build_metadata(size) - self.assertEqual(actual, {key: expected[key] for key in - ("source_sha256", "config", "n_objects")}) - finally: - compiler_v2.cleanup_build_dir(root) + kernels = "src/CelerisLab/lbm/kernels" + if subprocess.run(["git", "-C", str(REPO), "cat-file", "-e", + f"{NUMERICAL_REVISION}^{{commit}}"], capture_output=True).returncode: + self.fail(f"{NUMERICAL_REVISION} is not in this clone; the pinned build " + "sources cannot be checked") + archive = subprocess.run(["git", "-C", str(REPO), "archive", "--format=tar", + NUMERICAL_REVISION, kernels], + capture_output=True, check=True).stdout + with tempfile.TemporaryDirectory() as snapshot: + with tarfile.open(fileobj=io.BytesIO(archive)) as tar: + tar.extractall(snapshot) + with patch.object(compiler_v2, "_KERNEL_DIR", str(Path(snapshot) / kernels)): + for size in (128, 256): + with self.subTest(size=size): + cfg = replace(run_case.config(size, 100), nx=10, ny=10) + cfg.validate() + root = compiler_v2.generate_config(cfg) + try: + actual = json.loads((Path(root) / ".celeris-build").read_text()) + expected = build_metadata(size) + self.assertEqual(actual, {key: expected[key] for key in + ("source_sha256", "config", "n_objects")}) + finally: + compiler_v2.cleanup_build_dir(root) def test_source_preflight_requires_clean_exact_revision_and_tree(self): import oracle