From 9d5a629567604cab969fb324934012fbfd35fd08 Mon Sep 17 00:00:00 2001 From: coah <100182500+coah80@users.noreply.github.com> Date: Thu, 8 Oct 2026 16:17:25 -0500 Subject: [PATCH] fix: account for AOSSData in strict completion unit count --- tools/check_decomp_complete.py | 2 +- tools/test_workflow_guards.py | 39 ++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/tools/check_decomp_complete.py b/tools/check_decomp_complete.py index 249869de..e0554d55 100644 --- a/tools/check_decomp_complete.py +++ b/tools/check_decomp_complete.py @@ -9,7 +9,7 @@ from pathlib import Path EXPECTED_DOL_SHA1 = "26116613f624061ba99c8d1a299aaa6efa85670d" -EXPECTED_TOTAL_UNITS = 1027 +EXPECTED_TOTAL_UNITS = 1028 EXPECTED_TOTAL_CODE = 2995176 EXPECTED_TOTAL_DATA = 1832684 EXPECTED_TOTAL_FUNCTIONS = 12563 diff --git a/tools/test_workflow_guards.py b/tools/test_workflow_guards.py index fd16793b..0e296745 100644 --- a/tools/test_workflow_guards.py +++ b/tools/test_workflow_guards.py @@ -182,12 +182,10 @@ class WorkflowGuardTests(unittest.TestCase): failures = check_report(report) self.assertFalse(any("enc_dummy section .sbss" in failure for failure in failures)) - @unittest.skipUnless( - (Path(__file__).resolve().parents[1] / "build/43U/report.json").is_file(), - "generated 43U report is not available", - ) - def test_complete_report_schema_passes(self): + def complete_report(self): report_path = Path(__file__).resolve().parents[1] / "build/43U/report.json" + if not report_path.is_file(): + self.skipTest("generated 43U report is not available") report = copy.deepcopy(json.loads(report_path.read_text(encoding="utf-8"))) def fill(measures): @@ -230,7 +228,36 @@ class WorkflowGuardTests(unittest.TestCase): function["fuzzy_match_percent"] = 100.0 for category in report["categories"]: fill(category["measures"]) - self.assertEqual(check_report(report), []) + return report + + def test_complete_report_schema_passes(self): + self.assertEqual(check_report(self.complete_report()), []) + + def test_missing_or_extra_unit_fails(self): + for total_units in (1027, 1029): + with self.subTest(total_units=total_units): + report = self.complete_report() + if total_units == 1027: + report["units"].pop() + else: + extra = copy.deepcopy(report["units"][-1]) + extra["name"] += "/extra" + report["units"].append(extra) + failures = check_report(report) + self.assertIn(f"unit report length: {total_units}", failures) + self.assertIn(f"unit aggregate total_units: {total_units} != 1028", failures) + + def test_wrong_unit_totals_fail(self): + for total_units in (1027, 1029): + with self.subTest(total_units=total_units): + report = self.complete_report() + delta = total_units - 1028 + for field in ("total_units", "complete_units"): + report["measures"][field] = total_units + report["categories"][0]["measures"][field] += delta + failures = check_report(report) + self.assertIn(f"overall total_units: {total_units} != 1028", failures) + self.assertIn(f"category total_units: {total_units} != 1028", failures) @unittest.skipUnless( (Path(__file__).resolve().parents[1] / "build/43U/report.json").is_file(), -- 2.49.1