#!/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 Phase10CVGuardrails(unittest.TestCase): @classmethod def setUpClass(cls):cls.data=json.loads((root/"manifests/retroarch/phase-1.0cv-launch-canary-offline-build-gate.json").read_text()) def test_gate(self): p=root/"manifests/retroarch/phase-1.0cu-exact-sdl-header-export-gate.json";self.assertEqual(hashlib.sha256(p.read_bytes()).hexdigest(),self.data["source_bindings"]["phase10cu_manifest_sha256"]) p=self.data["preflight"];self.assertEqual(p["stale_object_or_dependency_files"],0);self.assertTrue(p["target_elf_absent"] and p["target_map_absent"]);self.assertEqual(p["make_dry_run_commands"],121) o=self.data["one_shot"];self.assertEqual(o["attempts_authorized"],1);self.assertFalse(o["automatic_retry"] or o["clean_authorized"]) a=self.data["authorizations"];self.assertTrue(a["retroarch_target_build_authorized"]) for k in ("artifact_execution_eligible","artifact_transfer_eligible","artifact_installation_eligible","network_access_authorized","ps5_connection_authorized","device_transfer_authorized","device_execution_authorized"):self.assertFalse(a[k],k) if __name__=="__main__":unittest.main(argv=[__file__])