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

53 lines
2.2 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Phase-1.0BL consumed-attempt and new-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 Phase10BLGuardrails(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bl-fixture-import-failure-and-new-gate.json").read_text(encoding="utf-8"))
def test_parent_and_corrected_source_bound(self) -> None:
parent = root / "manifests/retroarch/phase-1.0bk-bounded-real-facade-host-fixture-gate.json"
bindings = self.data["source_bindings"]
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), bindings["phase10bk_manifest_sha256"])
self.assertRegex(bindings["corrected_runner_sha256"], r"^[0-9a-f]{64}$")
self.assertRegex(bindings["retroarch_commit"], r"^[0-9a-f]{40}$")
def test_bk_was_consumed_before_any_fixture(self) -> None:
result = self.data["consumed_bk_attempt"]
self.assertEqual(result["suite_attempts"], 1)
self.assertEqual(result["exit_code"], 1)
self.assertFalse(result["main_entered"])
self.assertFalse(result["facade_constructed"])
self.assertEqual(result["fixture_processes_started"], 0)
for key in ("materializer_invoked", "sdl_build_invoked", "retroarch_build_invoked", "device_action_invoked"):
self.assertFalse(result[key], key)
def test_new_permission_is_one_exact_nonautomatic_suite(self) -> None:
gate = self.data["new_bl_gate"]
self.assertEqual(gate["suite_attempts_authorized"], 1)
self.assertEqual(len(gate["fixtures"]), 4)
self.assertTrue(gate["contract_identical_to_phase10bk"])
self.assertFalse(gate["automatic_retry"])
auth = self.data["authorizations"]
self.assertTrue(auth["exact_corrected_host_fixture_suite_authorized"])
for key, value in auth.items():
if key != "exact_corrected_host_fixture_suite_authorized":
self.assertFalse(value, key)
if __name__ == "__main__":
unittest.main(argv=[__file__])