mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 02:11:36 -04:00
Merge pull request #480 from RetroPortingToolKit/fix/restamp-bios-emitter
bios: restamp the emitter fingerprints; fail ctest on a stale stamp
This commit is contained in:
@@ -1 +1 @@
|
||||
012434af40660484f2a6990dd9f6b2acb35d00bc514c3e85ba0a49ca211f3d33
|
||||
6f777c349081f0b31bbaed39224269698219bdc9ea85fbaf83f924698a4fb4e9
|
||||
|
||||
@@ -1 +1 @@
|
||||
aa351622ddd9c496b61bd0982e58230cb4fc3aac6e2a5a1e4899ccd51fc6dbe9
|
||||
852297730a86157bff30c08100f3decc395261935385288564d4eb0926952f67
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
"""Every committed generated/<stem>.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/<stem>.toml and commit generated/):\n "
|
||||
+ "\n ".join(stale))
|
||||
print(f"PASS: {len(stamps)} BIOS emitter stamps match the emitter")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user