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

50 lines
2.0 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Fail-closed Phase-1.0BA guardrails."""
import argparse
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 Phase10BAGuardrails(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data = json.loads((root / "manifests/retroarch/phase-1.0ba-target-profile-callsite-audit.json").read_text(encoding="utf-8"))
def test_callsite_is_post_cleanup_pre_exit(self) -> None:
call = self.data["callsite_contract"]
for key in ("rarch_main_return_required", "s15_before_d14",
"d14_before_process_exit", "early_return_initialized_mask_rejected"):
self.assertTrue(call[key])
self.assertFalse(call["terminal_emit_result_changes_exit_code"])
def test_profile_is_launcher_independent(self) -> None:
profile = self.data["profile_delta"]
self.assertEqual(profile["profile_name"], "launch-canary")
self.assertTrue(profile["inherits_write_diag_behavior"])
self.assertTrue(profile["same_elf_for_both_launch_arms"])
self.assertTrue(profile["adds_only_av_target_define"])
for key in ("launcher_define_forbidden", "new_socket_or_address_forbidden",
"runner_activation_forbidden"):
self.assertTrue(profile[key])
def test_build_and_device_gates_stay_closed(self) -> None:
auth = self.data["authorizations"]
self.assertTrue(auth["target_source_patch_authorized"])
self.assertTrue(auth["target_profile_addition_authorized"])
for key, value in auth.items():
if key not in ("target_source_patch_authorized", "target_profile_addition_authorized"):
self.assertFalse(value, key)
self.assertFalse(self.data["decision"]["cross_build_allowed"])
self.assertFalse(self.data["decision"]["device_action_allowed"])
if __name__ == "__main__":
unittest.main(argv=[__file__])