#!/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 Phase10CTGuardrails(unittest.TestCase): @classmethod def setUpClass(cls):cls.data=json.loads((root/"manifests/retroarch/phase-1.0ct-sdl-archive-export-result.json").read_text()) def test_result(self): p=root/"manifests/retroarch/phase-1.0cs-export-parent-correction-gate.json";self.assertEqual(hashlib.sha256(p.read_bytes()).hexdigest(),self.data["source_bindings"]["phase10cs_manifest_sha256"]) r=self.data["result"];self.assertTrue(r["exclusive_export_succeeded"] and r["source_retained"]);self.assertEqual(r["attempts_consumed"],1) self.assertFalse(self.data["makefile_audit"]["exported_include_roots_present"]) for value in self.data["authorizations"].values():self.assertFalse(value) if __name__=="__main__":unittest.main(argv=[__file__])