Skip to content

feat(testkit): CI guardrails + headless runner for compiler validation#39

Merged
begeistert merged 3 commits into
masterfrom
feat/testkit-ci-guards
Jun 6, 2026
Merged

feat(testkit): CI guardrails + headless runner for compiler validation#39
begeistert merged 3 commits into
masterfrom
feat/testkit-ci-guards

Conversation

@begeistert
Copy link
Copy Markdown
Collaborator

Description

Makes RP2040Sharp a robust firmware/compiler testkit (e.g. for PyMCU) that never flakes
or hangs in CI, and prepares the repo for the 1.0.0 stable release.

TestKit CI guardrails

  • RP2040TestSimulation.RunUntilHalt(predicate, maxInstructions) — a bounded run that
    cannot hang; returns a diagnostic RunResult (PredicateMet / LockedUp /
    BudgetReached) so wedged or crashed firmware fails the test with a reason instead of
    stalling the job.
  • CPU-health assertions: NotBeLockedUp(), NotHaveFaulted(), BeInThreadMode(),
    HaveExecutedAtMost(n).
  • InstructionCount — deterministic, reproducible metric for compiler-size regressions.

Headless runner CLI (src/RP2040Sharp.Runner)

  • Loads a UF2/bin, runs under a hard instruction budget, watches UART/USB-CDC for
    --expect-text, and exits 0 (found) / 1 (not found) / 2 (crashed). The rp2040js-style
    --expect-text workflow, headless. Verified end-to-end against hello_uart.uf2.

Release prep

  • Repository URLs pointed at the PyMCU org (RepositoryUrl/PackageProjectUrl, README,
    CHANGELOG links). Still published by begeistert.
  • CHANGELOG closed for 1.0.0.

Tests: 453 unit + 149 integration, all green. Adds 8 CiGuardsTests (incl. a UDF
double-fault lockup case). The runner is IsPackable=false, so dotnet pack still emits
only RP2040Sharp and RP2040Sharp.TestKit.

Type of change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🧹 Refactoring (no functional changes, just code cleanup)

Checklist

  • 🧪 Tests passed locally (dotnet test)
  • ✅ Added new tests for this feature/fix
  • 📝 Documentation updated (if applicable)
  • 🚫 No "Magic Strings" or hardcoded values
  • 💾 Validated against the RP2040 Datasheet (if applicable)

Screenshots / Hex Dumps (Optional)

Runner exit codes (verified):

hello_uart.uf2 --expect-text "Hello"   → exit 0  (OK: found "Hello" after 6810 instructions)
... --expect-text "NEVER"              → exit 2  (firmware crashed)
missing.uf2                            → exit 66 (no input)
(no args)                              → exit 64 (usage)

begeistert and others added 3 commits June 6, 2026 02:33
Make the emulator a robust firmware/compiler testkit (e.g. for PyMCU) that never
flakes or hangs in CI — addressing the classes of problems users hit with rp2040js
(infinite-loop/alarm hangs, host-clock non-determinism).

- RunUntilHalt(predicate, maxInstructions): a bounded run that cannot hang; returns
  a diagnostic RunResult (PredicateMet / LockedUp / BudgetReached) so wedged or
  crashed firmware fails the test with a reason instead of stalling the job.
- CPU-health assertions: NotBeLockedUp, NotHaveFaulted, BeInThreadMode,
  HaveExecutedAtMost(n).
- InstructionCount: deterministic, reproducible metric for compiler-size regressions.
- rp2040sharp runner CLI (src/RP2040Sharp.Runner): load UF2/bin, run under a hard
  budget, watch UART/USB-CDC for --expect-text, exit 0 found / 1 not found / 2 crashed.

Adds 8 CiGuardsTests (incl. UDF double-fault lockup). 453 unit tests green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The repo moved to https://github.com/PyMCU/RP2040Sharp. Update RepositoryUrl /
PackageProjectUrl (embedded in the .nuspec), the README badge/clone URL, and the
CHANGELOG compare links. Authorship and publishing stay with begeistert.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@begeistert begeistert requested a review from lmSeryi as a code owner June 6, 2026 21:48
@begeistert begeistert merged commit 8074635 into master Jun 6, 2026
4 checks passed
@begeistert begeistert deleted the feat/testkit-ci-guards branch June 6, 2026 21:51
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