27 lines
1.3 KiB
Python
27 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""Phase-1.0CO exact cleanup guardrails."""
|
|
|
|
import argparse, hashlib, json, unittest
|
|
from pathlib import Path
|
|
parser=argparse.ArgumentParser(); parser.add_argument("--root",type=Path,required=True); root=parser.parse_args().root
|
|
|
|
class Phase10COGuardrails(unittest.TestCase):
|
|
@classmethod
|
|
def setUpClass(cls):
|
|
cls.data=json.loads((root/"manifests/retroarch/phase-1.0co-configure-success-build-output-limit-cleanup-gate.json").read_text(encoding="utf-8"))
|
|
def test_parent_and_result(self):
|
|
parent=root/"manifests/retroarch/phase-1.0cn-measured-native-sdl-materializer-one-shot-gate.json"
|
|
self.assertEqual(hashlib.sha256(parent.read_bytes()).hexdigest(),self.data["source_bindings"]["phase10cn_manifest_sha256"])
|
|
result=self.data["consumed_attempt"]
|
|
self.assertEqual(result["completed_through"],"cmake_configure_sdl_only")
|
|
self.assertEqual(result["object_files_after"],46)
|
|
self.assertTrue(result["archive_absent"])
|
|
def test_cleanup_only(self):
|
|
auth=self.data["authorizations"]
|
|
self.assertTrue(auth["exact_native_root_cleanup_authorized"])
|
|
for key,value in auth.items():
|
|
if key!="exact_native_root_cleanup_authorized": self.assertFalse(value,key)
|
|
|
|
if __name__=="__main__": unittest.main(argv=[__file__])
|