Skip to content

Refactor GPIO mocks to be self-contained#289

Merged
jmmv merged 1 commit intomasterfrom
gpio-mocks
Mar 1, 2026
Merged

Refactor GPIO mocks to be self-contained#289
jmmv merged 1 commit intomasterfrom
gpio-mocks

Conversation

@jmmv
Copy link
Collaborator

@jmmv jmmv commented Mar 1, 2026

Replace the old MockPins implementation, which borrowed the machine's symbol table at call time and required users to set up __GPIO_MOCK_DATA and __GPIO_MOCK_LAST variables, with a self-contained MockPins that maintains its own reads queue and operation trace.

Add a GPIO_MOCK_INJECT command and a GPIO_MOCK_TRACE function (registered only with --gpio-pins=mock) to pre-seed reads and dump the trace, and add a --gpio-pins CLI flag to select between rppal, noop, and mock backends. Rewrite the gpio.bas integration test to use these commands instead of the old magic variables. Update all unit tests to use the new make_mock_machine helper directly.

Replace the old MockPins implementation, which borrowed the machine's symbol
table at call time and required users to set up __GPIO_MOCK_DATA and
__GPIO_MOCK_LAST variables, with a self-contained MockPins that maintains its
own reads queue and operation trace.

Add a GPIO_MOCK_INJECT command and a GPIO_MOCK_TRACE function
(registered only with --gpio-pins=mock) to pre-seed reads and dump the
trace, and add a --gpio-pins CLI flag to select between rppal, noop, and
mock backends.  Rewrite the gpio.bas integration test to use these
commands instead of the old magic variables.  Update all unit tests to
use the new make_mock_machine helper directly.
@jmmv jmmv merged commit a35fa94 into master Mar 1, 2026
10 checks passed
@jmmv jmmv deleted the gpio-mocks branch March 1, 2026 23:36
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.

1 participant