46 lines
1.9 KiB
Python
46 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Tracked guardrails for Phase-1.0AP."""
|
|
|
|
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 Phase10APGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls) -> None:
|
|
cls.data = json.loads((ROOT / "manifests/retroarch/phase-1.0ap-worker-feasibility-audit.json").read_text(encoding="utf-8"))
|
|
|
|
def test_candidate_is_not_runtime_proof(self) -> None:
|
|
worker = self.data["worker_creation"]
|
|
self.assertTrue(worker["rfork_thread_declared_by_public_sdk"])
|
|
self.assertTrue(worker["rfork_thread_used_by_official_shsrv"])
|
|
self.assertFalse(worker["pid_birth_identity_or_generation_token_present"])
|
|
self.assertFalse(worker["firmware_960_behavior_proven"])
|
|
|
|
def test_preemption_and_result_remain_blocked(self) -> None:
|
|
self.assertFalse(self.data["preemption"]["waitpid_calls_are_bounded"])
|
|
self.assertFalse(self.data["preemption"]["blocked_mdbg_or_ptrace_io_kill_completion_proven"])
|
|
self.assertFalse(self.data["result_channel"]["fixed_size_worker_result_record_present"])
|
|
self.assertFalse(self.data["result_channel"]["bounded_receive_and_deadline_present"])
|
|
|
|
def test_no_source_copy_target_or_device_authority(self) -> None:
|
|
self.assertFalse(any(self.data["authorizations"].values()))
|
|
self.assertFalse(self.data["decision"]["copy_current_shsrv_code_allowed"])
|
|
self.assertFalse(self.data["decision"]["target_worker_architecture_feasible"])
|
|
self.assertFalse(self.data["decision"]["target_implementation_allowed"])
|
|
self.assertFalse(self.data["decision"]["device_action_allowed"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main(argv=[__file__])
|