test(firmware): gated USB flash round-trip + validated end-to-end flash (#99) - #118
Merged
Merged
Conversation
Drives the real flipperzero_firmware_install tool over USB to flash the device to the opposite firmware flavor and back, asserting after_confirmed and the observed flavor each direction. Restores the device to its starting flavor so it leaves no net change. Guarded behind FLIPPER_RUN_FLASH_TEST so it never runs in the ordinary integration/usb sweep (each direction reboots the device and takes minutes). Part of #99 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
End-to-end USB validation flashed Official -> Momentum successfully, but the tool raised "device did not reconnect after the update" because the Momentum bundle's larger resources made the on-device updater re-enumerate just past the 300 s budget - a false negative on a flash that had applied. The device returned to mntm-012 moments after the budget expired. Raise the budget to 600 s so the slow apply is awaited instead of misreported. Part of #99 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A forward-flash assertion failure previously skipped the flash back, leaving the device on the opposite firmware despite the docstring's no-net-change promise. Run the restore in a finally block and type the helper return. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Closed
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses the remaining open items in #99 (USB firmware-flash hardening / end-to-end validation).
What's here
A gated
integration+usbtest,test_usb_firmware_flash_roundtrip, that drives the realflipperzero_firmware_installtool over USB: it reads the device's current flavor, flashes to the opposite flavor, assertsafter_confirmedand the observed flavor, then flashes back to the starting flavor (leaving no net change). Guarded behindFLIPPER_RUN_FLASH_TEST=1so it never runs in the ordinaryintegration/usbsweep — each direction reboots the device and takes ~20 min.End-to-end validation (real hardware, Momentum mntm-012 device "Lun10n", USB)
First successful full flash — every prior attempt aborted before the reboot step.
Round-trip back to Momentum validated in the same way. The earlier
storage_md5sum-returns-None-after-large-write and session-wedge failure modes from #99 were already addressed by #104/#105; this run exercised them on real hardware without a wedge.Findings
storage_writepush is slow — ~19 min to push the ~2.5 MB Official bundle, and it emits no log lines mid-push (looks like a hang at 0% CPU but is I/O-bound pacing). Worth a follow-up to surface push progress and/or tune pacing./ext/update/diag,/ext/update/mcp-update) were already absent on the device — no cleanup needed.tests/golden/fixtures/{official,momentum}/(from test(golden): dual-firmware golden fixtures (Momentum + Official) #106).ruff+tyclean; test collects (gated-skip without the env flag).Part of #99
🤖 Generated with Claude Code
Supersedes #115 (rebased onto phase1). Review change: the restore flash now runs in a
finally, so an assertion failure on the forward flash still flashes the device back to its starting flavor.