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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f4372a84c0
commit
c95a7baae4
@@ -249,19 +249,35 @@ class ProjectedPairsTests(unittest.TestCase):
|
|||||||
self.assertFalse(assess(incomplete)["comparisons"][3]["passed"])
|
self.assertFalse(assess(incomplete)["comparisons"][3]["passed"])
|
||||||
|
|
||||||
def test_pinned_build_sources_match_host_generated_inputs(self):
|
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
|
from CelerisLab.cuda import compiler_v2
|
||||||
|
|
||||||
for size in (128, 256):
|
kernels = "src/CelerisLab/lbm/kernels"
|
||||||
cfg = replace(run_case.config(size, 100), nx=10, ny=10)
|
if subprocess.run(["git", "-C", str(REPO), "cat-file", "-e",
|
||||||
cfg.validate()
|
f"{NUMERICAL_REVISION}^{{commit}}"], capture_output=True).returncode:
|
||||||
root = compiler_v2.generate_config(cfg)
|
self.fail(f"{NUMERICAL_REVISION} is not in this clone; the pinned build "
|
||||||
try:
|
"sources cannot be checked")
|
||||||
actual = json.loads((Path(root) / ".celeris-build").read_text())
|
archive = subprocess.run(["git", "-C", str(REPO), "archive", "--format=tar",
|
||||||
expected = build_metadata(size)
|
NUMERICAL_REVISION, kernels],
|
||||||
self.assertEqual(actual, {key: expected[key] for key in
|
capture_output=True, check=True).stdout
|
||||||
("source_sha256", "config", "n_objects")})
|
with tempfile.TemporaryDirectory() as snapshot:
|
||||||
finally:
|
with tarfile.open(fileobj=io.BytesIO(archive)) as tar:
|
||||||
compiler_v2.cleanup_build_dir(root)
|
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):
|
def test_source_preflight_requires_clean_exact_revision_and_tree(self):
|
||||||
import oracle
|
import oracle
|
||||||
|
|||||||
Reference in New Issue
Block a user