Cover the plan cross-check in the .afw gate tests

Assert that the checker accepts a matching plan size and rejects a plan
whose p1 size disagrees with the manifest.

Co-Authored-By: DeepSeek Harness <noreply@deepseek.com>
This commit is contained in:
2026-11-04 14:33:32 -06:00
co-authored by DeepSeek Harness
parent 553f6a04fb
commit c1736f65e8
+21
View File
@@ -314,6 +314,27 @@ class AfwTests(unittest.TestCase):
self.assertNotEqual(result.returncode, 0)
self.assertIn("required image is missing", result.stderr)
def test_plan_size_cross_check(self):
bundle = build_afw(self.temp, self.input)
plan = self.temp / "plan.json"
plan.write_text(json.dumps({
"board": "cv1835",
"arch": "arm64",
"bootloader_policy": "preserve",
"partitions": [{"name": "p1", "size": P1}],
}))
result = self.check(bundle, "--allow-unsigned", "--plan", plan)
self.assertEqual(result.returncode, 0, result.stderr)
plan.write_text(json.dumps({
"board": "cv1835",
"arch": "arm64",
"bootloader_policy": "preserve",
"partitions": [{"name": "p1", "size": P1 - 1}],
}))
result = self.check(bundle, "--allow-unsigned", "--plan", plan)
self.assertNotEqual(result.returncode, 0)
self.assertIn("differs from the manifest", result.stderr)
def test_unknown_board_fails(self):
result = run(
[