Files
chimera-gfx-Public/tests/test_retroarch_phase10bk.py
T
Chimera GFX release export a6037502d7
phase0-ci / build-and-audit (push) Successful in 2m14s
Publish Chimera GFX source
2026-09-03 03:27:14 +02:00

51 lines
2.2 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Phase-1.0BK exact host-fixture gate guardrails."""
import argparse
import hashlib
import json
from pathlib import Path
import unittest
parser = argparse.ArgumentParser()
parser.add_argument("--root", type=Path, required=True)
root = parser.parse_args().root
class Phase10BKGuardrails(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bk-bounded-real-facade-host-fixture-gate.json").read_text(encoding="utf-8"))
def test_exact_parent_and_runtime(self) -> None:
parent = root / "manifests/retroarch/phase-1.0bj-exact-host-tool-install-result.json"
bindings = self.data["source_bindings"]
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), bindings["phase10bj_manifest_sha256"])
self.assertEqual(bindings["python_path"], "/usr/bin/python3.14")
self.assertRegex(bindings["python_sha256"], r"^[0-9a-f]{64}$")
def test_four_exact_bounded_fixtures(self) -> None:
fixtures = self.data["fixture_contract"]
self.assertEqual(fixtures["suite_attempts"], 1)
self.assertEqual(fixtures["per_fixture_attempts"], 1)
self.assertEqual(set(fixtures) - {"suite_attempts", "per_fixture_attempts"}, {"success", "nonzero", "overflow", "timeout"})
for name in ("success", "nonzero", "overflow", "timeout"):
fixture = fixtures[name]
self.assertEqual(fixture["argv"][0], "/usr/bin/python3.14")
self.assertLessEqual(fixture["timeout_seconds"], 2)
self.assertEqual(fixture["output_limit"], 64)
def test_authority_stays_host_fixture_only(self) -> None:
auth = self.data["authorizations"]
self.assertTrue(auth["exact_host_fixture_suite_authorized"])
for key, value in auth.items():
if key != "exact_host_fixture_suite_authorized":
self.assertFalse(value, key)
self.assertFalse(self.data["decision"]["materialization_allowed"])
self.assertFalse(self.data["decision"]["device_action_allowed"])
if __name__ == "__main__":
unittest.main(argv=[__file__])