#!/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 Phase10CQGuardrails(unittest.TestCase): @classmethod def setUpClass(cls):cls.data=json.loads((root/"manifests/retroarch/phase-1.0cq-full-output-native-sdl-one-shot-gate.json").read_text()) def test_gate(self): p=root/"manifests/retroarch/phase-1.0cp-build-output-limit-correction-gate.json";self.assertEqual(hashlib.sha256(p.read_bytes()).hexdigest(),self.data["source_bindings"]["phase10cp_manifest_sha256"]) o=self.data["one_shot"];self.assertEqual(o["attempts_authorized"],1);self.assertEqual(o["build_output_limit"],1048576);self.assertFalse(o["automatic_retry"]) a=self.data["authorizations"] for k in ("archive_export_authorized","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__])