#!/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 Phase10CWGuardrails(unittest.TestCase): @classmethod def setUpClass(cls):cls.data=json.loads((root/"manifests/retroarch/phase-1.0cw-launch-canary-artifact-audit.json").read_text()) def test_audit(self): p=root/"manifests/retroarch/phase-1.0cv-launch-canary-offline-build-gate.json";self.assertEqual(hashlib.sha256(p.read_bytes()).hexdigest(),self.data["source_bindings"]["phase10cv_manifest_sha256"]) a=self.data["static_audit"];self.assertFalse(a["writable_executable_segment"]);self.assertEqual(len(a["needed"]),7);self.assertEqual(a["socket_constructor_imports"],[]);self.assertEqual(a["receive_imports"],[]);self.assertTrue(a["d14_emitter_present"] and a["diagnostic_stream_present"]) l=self.data["limitations"];self.assertFalse(l["second_independent_build_performed"] or l["byte_reproducibility_proven"] or l["firmware_behavior_proven"]) for value in self.data["authorizations"].values():self.assertFalse(value) if __name__=="__main__":unittest.main(argv=[__file__])