From 545194860d9ae2d01f5b8d4ac1e675b5fa560532 Mon Sep 17 00:00:00 2001 From: Matthew Stanley <1379tech@gmail.com> Date: Fri, 2 Oct 2026 15:41:01 -0700 Subject: [PATCH 1/2] bios: restamp the emitter fingerprints 2163035e and 85c88d26 changed config_loader.cpp (a fingerprint input) without restamping; a full regen is byte-identical, so only the stamps move. Co-Authored-By: Claude Opus 5.5 (1M context) --- generated/OpenBIOS.emitter.sha | 2 +- generated/SCPH1001.emitter.sha | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generated/OpenBIOS.emitter.sha b/generated/OpenBIOS.emitter.sha index 150fa94d..f2c743ad 100644 --- a/generated/OpenBIOS.emitter.sha +++ b/generated/OpenBIOS.emitter.sha @@ -1 +1 @@ -012434af40660484f2a6990dd9f6b2acb35d00bc514c3e85ba0a49ca211f3d33 +6f777c349081f0b31bbaed39224269698219bdc9ea85fbaf83f924698a4fb4e9 diff --git a/generated/SCPH1001.emitter.sha b/generated/SCPH1001.emitter.sha index 07b17342..eab4c4f3 100644 --- a/generated/SCPH1001.emitter.sha +++ b/generated/SCPH1001.emitter.sha @@ -1 +1 @@ -aa351622ddd9c496b61bd0982e58230cb4fc3aac6e2a5a1e4899ccd51fc6dbe9 +852297730a86157bff30c08100f3decc395261935385288564d4eb0926952f67 From 6545e54a9ecc2a286a4878066fdaa9f95dce2cfe Mon Sep 17 00:00:00 2001 From: Matthew Stanley <1379tech@gmail.com> Date: Fri, 2 Oct 2026 15:41:39 -0700 Subject: [PATCH 2/2] tests: fail when a committed BIOS emitter stamp is stale Co-Authored-By: Claude Opus 5.5 (1M context) --- recompiler/CMakeLists.txt | 4 ++ recompiler/tests/test_bios_emitter_stamps.py | 43 ++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 recompiler/tests/test_bios_emitter_stamps.py diff --git a/recompiler/CMakeLists.txt b/recompiler/CMakeLists.txt index 282cba2f..56522f82 100644 --- a/recompiler/CMakeLists.txt +++ b/recompiler/CMakeLists.txt @@ -721,6 +721,10 @@ if(BUILD_TESTING) COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_optional_netplay_auth.py --cxx ${CMAKE_CXX_COMPILER}) + add_test(NAME bios_emitter_stamps + COMMAND ${Python3_EXECUTABLE} + ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_bios_emitter_stamps.py + --cmake ${CMAKE_COMMAND}) add_test(NAME pgo_rebuild_flow COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_pgo_rebuild_flow.py) diff --git a/recompiler/tests/test_bios_emitter_stamps.py b/recompiler/tests/test_bios_emitter_stamps.py new file mode 100644 index 00000000..fb0bbc53 --- /dev/null +++ b/recompiler/tests/test_bios_emitter_stamps.py @@ -0,0 +1,43 @@ +"""Every committed generated/.emitter.sha matches the current emitter. + +runtime.cmake compares these stamps only at title configure time, and only +fatally in release CI, so a change to a fingerprint input (emitter sources, +cycle headers, a profile or its seeds) that forgets to restamp sails through +the test suite. This test makes that drift fail here instead. +""" +import argparse +from pathlib import Path +import subprocess + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument("--cmake", required=True) + ap.add_argument("--root", type=Path, + default=Path(__file__).resolve().parents[2]) + args = ap.parse_args() + root = args.root + stamps = sorted((root / "generated").glob("*.emitter.sha")) + assert stamps, "no generated/*.emitter.sha stamps found" + stale = [] + for stamp in stamps: + stem = stamp.name[:-len(".emitter.sha")] + profile = root / "bios" / (stem + ".toml") + assert profile.exists(), f"{stamp.name} has no bios/{stem}.toml profile" + p = subprocess.run( + [args.cmake, f"-DROOT={root}", f"-DPROFILE=bios/{stem}.toml", + "-P", str(root / "tools" / "bios_emitter_fingerprint.cmake")], + cwd=root, capture_output=True, text=True, timeout=120) + assert p.returncode == 0, p.stderr + now = p.stdout.strip().splitlines()[-1].strip() + saved = stamp.read_text(encoding="utf-8").strip() + if now != saved: + stale.append(f"{stem}: stamp {saved} now {now}") + assert not stale, ("stale BIOS emitter stamps (run tools/regen_bios.sh " + "--config bios/.toml and commit generated/):\n " + + "\n ".join(stale)) + print(f"PASS: {len(stamps)} BIOS emitter stamps match the emitter") + + +if __name__ == "__main__": + main()