#!/usr/bin/env python3 # SPDX-License-Identifier: GPL-3.0-or-later import argparse,hashlib,json,unittest from pathlib import Path parser=argparse.ArgumentParser();parser.add_argument("--root",type=Path,required=True);root=parser.parse_args().root class Phase10CUGuardrails(unittest.TestCase): @classmethod def setUpClass(cls):cls.data=json.loads((root/"manifests/retroarch/phase-1.0cu-exact-sdl-header-export-gate.json").read_text()) def test_gate(self): p=root/"manifests/retroarch/phase-1.0ct-sdl-archive-export-result.json";self.assertEqual(hashlib.sha256(p.read_bytes()).hexdigest(),self.data["source_bindings"]["phase10ct_manifest_sha256"]) self.assertEqual(self.data["trees"]["include/SDL2"]["regular_files"],78);self.assertEqual(self.data["trees"]["include-config-release/SDL2"]["regular_files"],1) o=self.data["one_shot"];self.assertEqual(o["attempts_authorized"],1);self.assertTrue(o["exclusive_stage"] and o["exclusive_files"] and o["file_fsync"] and o["reopen_rehash"]);self.assertFalse(o["automatic_retry"] or o["cleanup_on_failure_authorized"]) a=self.data["authorizations"];self.assertTrue(a["sdl_header_export_authorized"]) for k in ("retroarch_target_build_authorized","network_access_authorized","ps5_connection_authorized","device_transfer_authorized","device_execution_authorized"):self.assertFalse(a[k],k) if __name__=="__main__":unittest.main(argv=[__file__])