Files
chimera-gfx-Public/tests/test_retroarch_phase10cd.py
Chimera GFX release export a6037502d7
phase0-ci / build-and-audit (push) Successful in 2m14s
Publish Chimera GFX source
2026-09-03 03:27:14 +02:00

53 lines
2.3 KiB
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-3.0-or-later
"""Phase-1.0CD configure-timeout correction 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 Phase10CDGuardrails(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data = json.loads((root / "manifests/retroarch/phase-1.0cd-cleanup-result-and-configure-timeout-correction-gate.json").read_text(encoding="utf-8"))
def test_parent_and_cleanup_result(self) -> None:
parent = root / "manifests/retroarch/phase-1.0cc-cmake-timeout-and-exact-output-cleanup-gate.json"
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), self.data["source_bindings"]["phase10cc_manifest_sha256"])
result = self.data["cleanup_result"]
self.assertEqual(result["attempts"], 1)
self.assertEqual(result["exit_code"], 0)
for key in ("stage_absent_after", "build_absent_after",
"worktree_metadata_absent_after", "source_clean_after"):
self.assertTrue(result[key], key)
self.assertFalse(result["other_worktrees_removed"])
def test_only_configure_timeout_may_change(self) -> None:
correction = self.data["authorized_source_correction"]
self.assertEqual(correction["operation"], "cmake_configure_sdl_only")
self.assertEqual(correction["old_timeout_seconds"], 120)
self.assertEqual(correction["new_timeout_seconds"], 600)
self.assertFalse(correction["argv_change_authorized"])
self.assertFalse(correction["output_limit_change_authorized"])
self.assertFalse(correction["build_timeout_change_authorized"])
self.assertFalse(correction["automatic_retry"])
def test_only_source_change_is_open(self) -> None:
auth = self.data["authorizations"]
self.assertTrue(auth["request_graph_source_change_authorized"])
for key, value in auth.items():
if key != "request_graph_source_change_authorized":
self.assertFalse(value, key)
self.assertFalse(self.data["decision"]["materialization_allowed"])
if __name__ == "__main__":
unittest.main(argv=[__file__])