47 lines
1.9 KiB
Python
47 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Phase-1.0CF repeated-timeout cleanup 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 Phase10CFGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls) -> None:
|
|
cls.data = json.loads((root / "manifests/retroarch/phase-1.0cf-repeated-configure-timeout-and-cleanup-gate.json").read_text(encoding="utf-8"))
|
|
|
|
def test_parent_and_repeated_stop(self) -> None:
|
|
parent = root / "manifests/retroarch/phase-1.0ce-extended-configure-sdl-materializer-one-shot-gate.json"
|
|
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), self.data["source_bindings"]["phase10ce_manifest_sha256"])
|
|
result = self.data["consumed_attempt"]
|
|
self.assertEqual(result["timeout_seconds"], 600)
|
|
self.assertTrue(result["all_preconfigure_operations_completed"])
|
|
self.assertTrue(result["successful_try_compile_observed"])
|
|
self.assertFalse(result["sdl_build_invoked"])
|
|
|
|
def test_only_cleanup_is_open(self) -> None:
|
|
cleanup = self.data["cleanup"]
|
|
self.assertEqual(cleanup["attempts_authorized"], 1)
|
|
self.assertFalse(cleanup["automatic_retry"])
|
|
auth = self.data["authorizations"]
|
|
self.assertTrue(auth["exact_derived_output_cleanup_authorized"])
|
|
for key, value in auth.items():
|
|
if key != "exact_derived_output_cleanup_authorized":
|
|
self.assertFalse(value, key)
|
|
|
|
def test_mounted_root_is_rejected(self) -> None:
|
|
self.assertFalse(self.data["decision"]["mounted_buildroot_suitable"])
|
|
self.assertFalse(self.data["decision"]["materialization_allowed"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main(argv=[__file__])
|