Skip to content

ci: run the embedded tests in simavr instead of Wokwi - #168

Merged
FredM67 merged 1 commit into
devfrom
ci/simavr
Sep 30, 2026
Merged

FredM67 merged 1 commit into
devfrom
ci/simavr

Conversation

@FredM67

@FredM67 FredM67 commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Summary

Wokwi CI uses paid credits, and they are nearly used up. simavr runs the same embedded tests for free: no limits, no account, no token, and it also runs locally (Linux/WSL).

The Wokwi setup only ever used a bare Arduino Uno (diagram.json has no parts and no connections). The tests only exercise the ATmega328P itself: CPU math, pin registers, UART and timers. simavr emulates all of that cycle-accurately.

Changes

  • New uno_sim environment (platformio.ini). The tests run in simavr (platformio/tool-simavr, ATmega328P at 16 MHz, UART0 on stdout), and PlatformIO reads the Unity results itself. There is no upload step. Run it locally with pio test -e uno_sim.
  • The tests now stop at the end. Each suite called UNITY_END() inside loop(), so it repeated forever or spun silently. Wokwi hid this by stopping at the first OK. A small helper, haltAfterTests() (test/embedded/halt_after_tests.h), is now called right after UNITY_END(): the suite runs once, and simavr exits (it quits when the CPU sleeps with interrupts disabled).
  • CI: one "Embedded tests (simavr)" job runs every embedded test, benchmarks included. simavr counts cycles exactly, so their figures are reproducible. The job has a 15-minute timeout, so a hanging test fails instead of holding the runner for 6 hours.
  • Removed from CI: the test discovery job, the Wokwi CLI install, the JUnit conversion, the test reporter, the checks: write permission and the use of WOKWI_CLI_TOKEN.
  • Kept: wokwi.toml and diagram.json, so the tests can still be run interactively in the Wokwi VS Code extension.
  • Docs: test/README.md and one outdated comment in test_voltage_accumulation.

Testing

Notes

  • The pre-commit hooks also cleaned up existing trailing whitespace and a missing final newline in test_mult_asm and test_voltage_accumulation.
  • Once this is merged, the WOKWI_CLI_TOKEN secrets (Actions and Dependabot) are no longer used and can be deleted.

🤖 Generated with Claude Code

Wokwi CI needs paid credits; simavr is free, unlimited and runs locally.

- New `uno_sim` environment: the tests run in simavr (platformio/tool-simavr,
  a bare ATmega328P at 16 MHz, UART0 on stdout) and PlatformIO parses the
  Unity output itself. No upload step.
- Every embedded test now calls haltAfterTests() right after UNITY_END():
  the suite runs once instead of being repeated by loop(), and simavr exits
  (it quits when the CPU sleeps with interrupts disabled). Wokwi hid the
  repetition by stopping at the first "OK".
- CI: one "Embedded tests (simavr)" job runs every embedded test, benchmarks
  included (simavr is cycle-accurate), with a 15-minute timeout. The test
  discovery job, Wokwi CLI, JUnit conversion, test reporter and the
  WOKWI_CLI_TOKEN secret are no longer used.
- The wokwi.toml / diagram.json files are kept for the Wokwi VS Code
  extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@FredM67
FredM67 merged commit 9075df2 into dev Sep 30, 2026
9 checks passed
@FredM67
FredM67 deleted the ci/simavr branch September 30, 2026 17:17
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