Files
chimera-gfx-Public/tests/test_retroarch_phase10bu.py
T
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.0BU Windows-Git fixture gate 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 Phase10BUGuardrails(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bu-wsl-git-status-timeout-and-windows-git-fixture-gate.json").read_text(encoding="utf-8"))
def test_parent_and_second_bounded_stop(self) -> None:
parent = root / "manifests/retroarch/phase-1.0bt-corrected-timeout-one-shot-gate.json"
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(), self.data["source_bindings"]["phase10bt_manifest_sha256"])
result = self.data["consumed_attempt"]
self.assertEqual(result["failed_operation"], "verify_sdl_clean")
self.assertEqual(result["timeout_seconds"], 120)
self.assertTrue(result["process_group_terminated"])
for key in ("stage_absent_after", "build_absent_after", "archive_absent_after"):
self.assertTrue(result[key], key)
def test_fixture_is_two_exact_read_only_commands(self) -> None:
fixture = self.data["fixture"]
self.assertEqual(fixture["attempts_authorized"], 1)
self.assertEqual(len(fixture["commands"]), 2)
for command in fixture["commands"]:
self.assertEqual(command[0], "/mnt/c/Program Files/Git/cmd/git.exe")
self.assertNotIn("worktree", command)
self.assertEqual(fixture["commands"][0][-2:], ["rev-parse", "HEAD"])
self.assertEqual(fixture["commands"][1][-2:], ["status", "--porcelain"])
self.assertFalse(fixture["automatic_retry"])
def test_only_read_only_fixture_is_open(self) -> None:
auth = self.data["authorizations"]
self.assertTrue(auth["exact_windows_git_read_only_fixture_authorized"])
for key, value in auth.items():
if key != "exact_windows_git_read_only_fixture_authorized":
self.assertFalse(value, key)
self.assertFalse(self.data["decision"]["materialization_allowed"])
if __name__ == "__main__":
unittest.main(argv=[__file__])