17 lines
1.2 KiB
Python
17 lines
1.2 KiB
Python
#!/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 Phase10CPGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls): cls.data=json.loads((root/"manifests/retroarch/phase-1.0cp-build-output-limit-correction-gate.json").read_text(encoding="utf-8"))
|
|
def test_contract(self):
|
|
parent=root/"manifests/retroarch/phase-1.0co-configure-success-build-output-limit-cleanup-gate.json"
|
|
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(),self.data["source_bindings"]["phase10co_manifest_sha256"])
|
|
c=self.data["authorized_source_correction"]; self.assertEqual(c["old_output_limit"],65536); self.assertEqual(c["new_output_limit"],1048576); self.assertFalse(c["argv_change_authorized"]); self.assertFalse(c["timeout_change_authorized"])
|
|
a=self.data["authorizations"]; self.assertTrue(a["request_graph_source_change_authorized"])
|
|
for k,v in a.items():
|
|
if k!="request_graph_source_change_authorized": self.assertFalse(v,k)
|
|
if __name__=="__main__": unittest.main(argv=[__file__])
|