Commit 594e366
committed
fix(tests): derive the storage version from the tree, not from one branch
python-keepkey is ONE submodule shared by every firmware branch, and CI
now builds the emulator from whichever branch is under test. So a test
pinned to one branch's version reports a failure whose only cause is
which branch you are on. Two did:
test_active_flash_format_is_v20 assertEqual(20, version)
test_burned_versions_are_dispatched... "case StorageVersion_18:"
Both true on the passkeys branch, both FALSE on the 7.15 line, where
STORAGE_VERSION is 17 and nothing is burned. A third, at the reboot test,
was invisible only because CI has no emulator -- and pk-fix already
carried a local patch flipping its 17 to 20, so the rot was being papered
over branch by branch.
A test that reads a source file has to assert properties of what it read.
The ladder, the burned set, LAST_SHIPPED and which versions have readers
are now all derived per tree.
Burnedness cannot be inferred from storage.c alone: deleting the reader
for a SHIPPED version would silently reclassify it as burned and the
suite would bless the wipe. So two independent files are cross-checked --
storage_versions.inc DECLARES burned, storage.c DEMONSTRATES it (returns
SUS_Invalid, no reader) -- and set equality between them is asserted.
test_no_shipped_version_is_burned is the anchor: burned intersected with
[1..LAST_SHIPPED] must be empty, so the declaration can never authorise
wiping a format that reached hardware.
One number is still written down, STORAGE_VERSION_LAST_SHIPPED_FLOOR = 17,
and it is a FLOOR rather than an equality on purpose. 7.15 shipping V17 is
finished history and cannot become false, so it survives 7.16 raising the
constant. assertEqual(17, last_shipped) was the wrong shape: it goes false
the day 7.16 ships, so it rots and gets "fixed" by whoever it inconveniences
-- and lowering LAST_SHIPPED is the highest-severity item in
docs/StorageVersionGate.md, with both operands of its static assert living
in the same header where one commit reaches both.
Verified on BOTH trees from one file: 10 passed / 5 skipped against the
7.15 line, 15 passed against the 7.16 line. Not vacuous: 10 mutations
injected into throwaway copies, 9 fail loudly; the one that passes is a
complete deliberate bump (header + ladder + case + reader), which is
exactly what should pass.1 parent e294164 commit 594e366
1 file changed
Lines changed: 520 additions & 130 deletions
0 commit comments