46 lines
1.9 KiB
Python
46 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Phase-1.0CE extended-configure one-shot guardrails."""
|
|
|
|
import argparse
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
import unittest
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--root", type=Path, required=True)
|
|
root = parser.parse_args().root
|
|
|
|
|
|
class Phase10CEGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls) -> None:
|
|
cls.data = json.loads((root / "manifests/retroarch/phase-1.0ce-extended-configure-sdl-materializer-one-shot-gate.json").read_text(encoding="utf-8"))
|
|
|
|
def test_parent_and_sources_are_exact(self) -> None:
|
|
parent = root / "manifests/retroarch/phase-1.0cd-cleanup-result-and-configure-timeout-correction-gate.json"
|
|
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), self.data["source_bindings"]["phase10cd_manifest_sha256"])
|
|
self.assertEqual(self.data["source_bindings"]["retroarch_commit"], "e936a1fc36058a5df40cef1a805e6ae571fc2f4a")
|
|
|
|
def test_exact_bounded_one_shot(self) -> None:
|
|
one = self.data["one_shot"]
|
|
self.assertEqual(one["attempts_authorized"], 1)
|
|
self.assertEqual(one["configure_timeout_seconds"], 600)
|
|
self.assertEqual(one["build_timeout_seconds"], 600)
|
|
self.assertFalse(one["automatic_retry"])
|
|
self.assertFalse(one["cleanup_on_failure_authorized"])
|
|
|
|
def test_no_target_or_device_scope(self) -> None:
|
|
auth = self.data["authorizations"]
|
|
self.assertTrue(auth["materializer_invocation_authorized"])
|
|
self.assertTrue(auth["sdl_build_authorized"])
|
|
for key in ("retroarch_target_build_authorized", "network_access_authorized",
|
|
"ps5_connection_authorized", "device_transfer_authorized",
|
|
"device_execution_authorized"):
|
|
self.assertFalse(auth[key], key)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main(argv=[__file__])
|