40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Phase-1.0BB repository guardrails."""
|
|
|
|
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 Phase10BBGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls) -> None:
|
|
cls.data = json.loads((root / "manifests/retroarch/phase-1.0bb-source-only-launch-canary-profile.json").read_text(encoding="utf-8"))
|
|
|
|
def test_source_properties(self) -> None:
|
|
props = self.data["source_properties"]
|
|
for key in ("post_s15_pre_exit_call", "distinct_launch_canary_profile",
|
|
"inherits_write_diag", "launcher_independent_payload"):
|
|
self.assertTrue(props[key])
|
|
self.assertFalse(props["new_network_or_device_path"])
|
|
self.assertFalse(props["runner_activation"])
|
|
|
|
def test_only_prerequisite_audit_is_open(self) -> None:
|
|
auth = self.data["authorizations"]
|
|
self.assertTrue(auth["build_prerequisite_audit_authorized"])
|
|
for key, value in auth.items():
|
|
if key != "build_prerequisite_audit_authorized":
|
|
self.assertFalse(value, key)
|
|
self.assertFalse(self.data["decision"]["cross_build_allowed"])
|
|
self.assertFalse(self.data["decision"]["artifact_allowed"])
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main(argv=[__file__])
|