#!/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 Phase10CYGuardrails(unittest.TestCase): @classmethod def setUpClass(cls):cls.data=json.loads((root/"manifests/retroarch/phase-1.0cy-launch-canary-reproducibility-result.json").read_text()) def test_result(self): p=root/"manifests/retroarch/phase-1.0cx-isolated-reproducibility-build-gate.json";self.assertEqual(hashlib.sha256(p.read_bytes()).hexdigest(),self.data["source_bindings"]["phase10cx_manifest_sha256"]) c=self.data["comparison"];self.assertTrue(c["elf_byte_exact"] and c["map_byte_exact"]);self.assertEqual(c["first_elf_sha256"],c["second_elf_sha256"]);self.assertEqual(c["first_map_sha256"],c["second_map_sha256"]) b=self.data["independent_build"];self.assertFalse(b["current_objects_reused"] or b["network_action_invoked"] or b["device_action_invoked"]) for value in self.data["authorizations"].values():self.assertFalse(value) if __name__=="__main__":unittest.main(argv=[__file__])