Skip to content

tests: add a QEMU-based test which emulates a mock MM8108, brings it up and does a scan - #13

Merged
dpgeorge merged 5 commits into
micropython:mainfrom
dpgeorge:tests-add-qemu-mock
Oct 4, 2026
Merged

dpgeorge merged 5 commits into
micropython:mainfrom
dpgeorge:tests-add-qemu-mock

Conversation

@dpgeorge

@dpgeorge dpgeorge commented Oct 3, 2026

Copy link
Copy Markdown
Member

This PR adds a new tests/qemu_driver test which emulates a mock MM8108 chipset and tests the following calls to the driver:

  • mm_halow_wifi_set_up() (indirectly tests mm_halow_init())
  • mm_halow_wifi_scan_cached()
  • the scan result from a mock AP probe result is printed out

That tests quite a bit of the driver infrastructure and plumbing. It needs an SPI backend and the mock MM8108 needs to respond to a subset of the commands that the real hardware responds to.

The test prints out some things which are checked against test_bringup.exp, and that's run under CI. This should help prevent basic regressions in the driver. If the CI passes at least we know that a chip can be brought up.

I used Claude Code for most of this. It did a good job of writing the MM8108 emulator, based on SPI traces I captured from a real chip, along with it inspecting the mm-iot-sdk sources.

@dpgeorge
dpgeorge requested a review from kwagyeman October 3, 2026 07:03
@dpgeorge
dpgeorge force-pushed the tests-add-qemu-mock branch from 61ce4cb to 4475899 Compare October 3, 2026 07:09

@kwagyeman kwagyeman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Builds and passes here, fails correctly on a bad exit code or changed .exp. Note, chip_reg() has no bound check on its 16-entry table, add an abort at the end so it fails loudly if a future morselib touches more registers. Otherwise LGTM.

Signed-off-by: Damien George <damien@micropython.org>
The MM8108 emulator needed improvements to answer with a valid VIF ID.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge
dpgeorge force-pushed the tests-add-qemu-mock branch from 4475899 to 7edf540 Compare October 4, 2026 12:54
@dpgeorge
dpgeorge merged commit 7edf540 into micropython:main Oct 4, 2026
7 checks passed
@dpgeorge
dpgeorge deleted the tests-add-qemu-mock branch October 4, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants