Files
Yaya48 c230971f07 IOS LLE: checkpoint NAND conformance and diagnostic tooling
Preserve formatted NAND boot and Wii Remote pairing, add DMA/SRAM conformance tests and a Wii comparison probe. Keep P1 profiling tools and native update A/B evidence; reject the unhelpful targeted SRAM shortcut.
2026-09-23 13:30:17 +02:00

46 lines
2.0 KiB
Python

import unittest
from unittest.mock import patch
from compare_p1 import compare
class ComparisonTests(unittest.TestCase):
@staticmethod
def runs(on_mode, on_multiplier=1.01, off_values=(100, 100, 100, 100)):
result = []
for index, off in enumerate(off_values):
for mode, value in (("NoTrace", off), (on_mode, off * on_multiplier)):
result.append(dict(directory=f"run-{index}-{mode}", collection=mode,
hash="same-exe", pdb_hash="same-pdb",
affinity_mask=15, observed_affinity_mask=15, arm_ms=value,
wall_ms=value * 1.2, cpu_ms=value * .95))
return result
def test_repeated_low_noise_wpr_pairs_can_pass_local_budget(self):
runs = self.runs("WPRSystemAndNative")
with patch("compare_p1.load", side_effect=runs):
report = compare(list(range(len(runs))))
self.assertTrue(report["two_percent_budget_qualified"])
self.assertAlmostEqual(report["upper_95_percent"]["arm_phase_percent"], 1)
def test_private_logger_never_qualifies_full_wpr_budget(self):
runs = self.runs("PrivateUserMode")
with patch("compare_p1.load", side_effect=runs):
self.assertFalse(compare(list(range(len(runs))))["two_percent_budget_qualified"])
def test_large_baseline_spread_keeps_budget_unqualified(self):
runs = self.runs("WPRSystemAndNative", off_values=(100, 104, 100, 104))
with patch("compare_p1.load", side_effect=runs):
self.assertFalse(compare(list(range(len(runs))))["two_percent_budget_qualified"])
def test_mismatched_affinity_rejected(self):
runs = self.runs("WPRSystemAndNative")
runs[3]["observed_affinity_mask"] = 255
with patch("compare_p1.load", side_effect=runs):
with self.assertRaisesRegex(ValueError, "affinity"):
compare(list(range(len(runs))))
if __name__ == "__main__":
unittest.main()