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

45 lines
1.8 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Phase-1.0BF live-adapter boundary tests."""
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 Phase10BFGuardrails(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bf-live-sdl-adapter-boundary-audit.json").read_text(encoding="utf-8"))
def test_parent_binding(self) -> None:
parent = root / "manifests/retroarch/phase-1.0be-fake-only-sdl-materializer.json"
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(),
self.data["source_bindings"]["phase10be_manifest_sha256"])
def test_adapter_contract_is_fail_closed(self) -> None:
contract = self.data["adapter_contract"]
for key, value in contract.items():
if key in ("automatic_retry", "automatic_cleanup", "network_capability",
"retroarch_build_capability", "device_capability"):
self.assertFalse(value, key)
else:
self.assertTrue(value, key)
def test_only_dormant_source_is_open(self) -> None:
auth = self.data["authorizations"]
self.assertTrue(auth["dormant_live_adapter_source_authorized"])
for key, value in auth.items():
if key != "dormant_live_adapter_source_authorized":
self.assertFalse(value, key)
self.assertFalse(self.data["decision"]["tool_install_allowed"])
self.assertFalse(self.data["decision"]["materialization_allowed"])
if __name__ == "__main__":
unittest.main(argv=[__file__])