43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Manifest guardrails for Phase-1.0AF."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
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 Phase10AFGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls) -> None:
|
|
cls.data = json.loads((ROOT / "manifests/retroarch/phase-1.0af-bigapp-lifecycle-model.json").read_text(encoding="utf-8"))
|
|
|
|
def test_no_authority_or_target_claim(self) -> None:
|
|
self.assertFalse(any(self.data["authorizations"].values()))
|
|
self.assertFalse(self.data["decision"]["target_implementation_allowed"])
|
|
self.assertFalse(self.data["decision"]["device_action_allowed"])
|
|
|
|
def test_model_is_closed(self) -> None:
|
|
model = self.data["model"]
|
|
for key in ("target_code_present", "socket_present", "process_api_present",
|
|
"syscall_present", "real_clock_present", "filesystem_output_present",
|
|
"existing_bigapp_killed"):
|
|
self.assertFalse(model[key])
|
|
self.assertTrue(model["require_no_existing_bigapp"])
|
|
self.assertTrue(model["restore_before_child_termination"])
|
|
|
|
def test_runtime_blockers_remain(self) -> None:
|
|
self.assertGreaterEqual(len(self.data["remaining_blockers"]), 7)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main(argv=[__file__])
|