Files
chimera-gfx-Public/tests/test_retroarch_phase10bi.py
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

39 lines
1.6 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Phase-1.0BI audit guardrails."""
import argparse, hashlib, json
from pathlib import Path
import unittest
parser = argparse.ArgumentParser(); parser.add_argument("--root", type=Path, required=True)
root = parser.parse_args().root
class Phase10BIGuardrails(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bi-real-facade-and-tool-install-audit.json").read_text(encoding="utf-8"))
def test_parent_and_facade_contract(self) -> None:
parent = root / "manifests/retroarch/phase-1.0bh-bounded-sdl-executor.json"
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), self.data["source_bindings"]["phase10bh_manifest_sha256"])
contract = self.data["facade_contract"]
for key, value in contract.items():
if key in ("cli_present", "retry_present", "cleanup_present", "network_present", "device_present"):
self.assertFalse(value, key)
else:
self.assertTrue(value, key)
def test_narrow_authority(self) -> None:
auth = self.data["authorizations"]
self.assertTrue(auth["real_facade_source_authorized"])
self.assertTrue(auth["exact_package_install_authorized"])
for key, value in auth.items():
if key not in ("real_facade_source_authorized", "exact_package_install_authorized"):
self.assertFalse(value, key)
self.assertFalse(self.data["decision"]["materialization_allowed"])
if __name__ == "__main__": unittest.main(argv=[__file__])