47 lines
1.8 KiB
Python
47 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Phase-1.0BC prerequisite gate tests."""
|
|
|
|
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 Phase10BCGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls) -> None:
|
|
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bc-cross-build-prerequisite-audit.json").read_text(encoding="utf-8"))
|
|
|
|
def test_parent_binding(self) -> None:
|
|
parent = root / "manifests/retroarch/phase-1.0bb-source-only-launch-canary-profile.json"
|
|
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(),
|
|
self.data["source_bindings"]["phase10bb_manifest_sha256"])
|
|
|
|
def test_missing_prerequisites_are_explicit(self) -> None:
|
|
observed = self.data["observed_prerequisites"]
|
|
for key in ("wsl_cmake_present", "wsl_ninja_present",
|
|
"exact_sdl_archive_present", "launch_canary_elf_present",
|
|
"launch_canary_map_present"):
|
|
self.assertFalse(observed[key])
|
|
|
|
def test_only_materializer_source_is_open(self) -> None:
|
|
auth = self.data["authorizations"]
|
|
self.assertTrue(auth["materializer_source_authorized"])
|
|
for key, value in auth.items():
|
|
if key != "materializer_source_authorized":
|
|
self.assertFalse(value, key)
|
|
decision = self.data["decision"]
|
|
self.assertFalse(decision["prerequisites_complete"])
|
|
self.assertFalse(decision["unknown_archive_reuse_allowed"])
|
|
self.assertFalse(decision["cross_build_allowed"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main(argv=[__file__])
|