This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Tracked guardrails for Phase-1.0AK."""
|
||||
|
||||
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 Phase10AKGuardrails(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.data = json.loads((ROOT / "manifests/retroarch/phase-1.0ak-hybrid-composition.json").read_text(encoding="utf-8"))
|
||||
|
||||
def test_every_temporary_resource_has_explicit_ownership(self) -> None:
|
||||
ownership = self.data["ownership"]
|
||||
for key in ("host_mirror", "jit_master_descriptors",
|
||||
"jit_alias_descriptors", "host_alias_mappings",
|
||||
"remote_alias_mappings"):
|
||||
self.assertNotEqual(ownership[key], "ABSENT")
|
||||
self.assertTrue(ownership["reverse_cleanup"])
|
||||
|
||||
def test_cleanup_failure_is_fail_closed(self) -> None:
|
||||
ownership = self.data["ownership"]
|
||||
self.assertTrue(ownership["cleanup_failure_requires_child_termination"])
|
||||
self.assertTrue(ownership["failed_child_termination_is_hard_error"])
|
||||
self.assertFalse(ownership["partial_success_allowed"])
|
||||
|
||||
def test_no_target_or_device_authority(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"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(argv=[__file__])
|
||||
Reference in New Issue
Block a user