Skip to content

Run native PlatformIO tests by area for readable failures#11130

Merged
thebentern merged 2 commits into
developfrom
ci-native-tests-by-area
Jul 22, 2026
Merged

Run native PlatformIO tests by area for readable failures#11130
thebentern merged 2 commits into
developfrom
ci-native-tests-by-area

Conversation

@caveman99

@caveman99 caveman99 commented Jul 21, 2026

Copy link
Copy Markdown
Member

The native test job ran every test_* suite in a single platformio test -e coverage invocation. As the suite set grows, a failure deep in that one run can land past the log's viewable limit, so the failing assertion is not visible without downloading the raw log.

Change

Same job, same runner, same coverage. The run is split by area:

  • Build once. platformio test -e coverage --without-testing compiles src and every test program a single time.
  • Run by area. The suites are grouped into areas (admin, crypto, routing, position, fuzz, packets, io, misc) and run in sequential --without-building invocations that reuse that build. Each area writes its own JUnit report (testreport-<area>.xml) and its own collapsible log, so a failure is in a small named section instead of buried.
  • Coverage unchanged. The runs are sequential and share one build dir, so gcov counts still accumulate into .pio/build/coverage/src; a single capture holds the union. generate-reports merges base + integration + tests as before.

Grouping

Areas are ordered name:regex rules, first match wins, with a catch-all misc, so a newly added suite always runs even before it is placed in an area. Add a suite to an area by extending its regex; add an area with one rule line. All 38 current suites map with none dropped.

Sequential, so no build isolation or gcov races - this trades nothing for the readability, unlike a concurrent or matrix split which would each cost extra builds or runners.

Summary by CodeRabbit

  • Bug Fixes
    • Improved native CI test reliability by splitting execution into ordered test areas that run sequentially while reusing a shared build.
    • Enhanced CI test reporting by generating per-area JUnit reports and then consolidating them into a single combined testreport.xml.
    • Updated code coverage handling to automatically merge all discovered coverage_*.info inputs into a unified coverage result.

The native test job ran every test_* suite in a single platformio invocation,
so a failure in the growing suite set could land past the viewable log limit.

Build the test programs once, then run the suites grouped by area in sequential
invocations, each with its own JUnit report and collapsible log. The runs share
one build dir, so gcov coverage still accumulates and a single capture holds the
union. Areas are ordered regex rules with a catch-all, so a new suite always runs.
@caveman99 caveman99 added trunk github_actions Pull requests that update GitHub Actions code and removed trunk labels Jul 21, 2026
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 374cb183-abc3-4c08-9e22-27f901e7fd41

📥 Commits

Reviewing files that changed from the base of the PR and between 4906f8a and dfee95c.

📒 Files selected for processing (1)
  • .github/workflows/test_native.yml

📝 Walkthrough

Walkthrough

The native CI workflow now builds PlatformIO test programs once, runs discovered test suites sequentially by area, consolidates per-area JUnit reports into testreport.xml, and dynamically merges all generated coverage tracefiles.

Changes

Native CI workflow

Layer / File(s) Summary
Sequential native test execution
.github/workflows/test_native.yml
PlatformIO builds test programs once, discovers test_* suites, groups them by ordered area regex rules, runs areas without rebuilding, writes per-area JUnit files, filters skipped log rows, and fails when an area command fails.
Report consolidation and coverage merge
.github/workflows/test_native.yml
Per-area JUnit files are merged into testreport.xml before artifact upload and downstream reporting; coverage merging discovers all coverage_*.info files and combines them with lcov.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant PlatformIO
  participant TestAreas
  participant JUnitReports
  participant CoverageFiles
  GitHubActions->>PlatformIO: Build test programs once
  PlatformIO-->>GitHubActions: Return shared build artifacts
  GitHubActions->>TestAreas: Discover and group test_* suites
  GitHubActions->>PlatformIO: Run each area without rebuilding
  PlatformIO->>JUnitReports: Write per-area XML reports
  GitHubActions->>JUnitReports: Merge reports into testreport.xml
  GitHubActions->>JUnitReports: Upload consolidated testreport.xml
  GitHubActions->>CoverageFiles: Merge coverage_*.info with lcov
Loading

Suggested reviewers: vidplace7, nomdetom

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: grouping native PlatformIO tests by area for clearer failures.
Description check ✅ Passed The description covers the change, grouping logic, coverage, and report merging, but omits the template's attestation/checklist section.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci-native-tests-by-area

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/test_native.yml (1)

157-179: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Preserve the downstream testreport.xml contract.

This now produces/uploads only testreport-*.xml, but .github/workflows/pr_tests.yml:83-113 parses only testreport.xml. Its detailed-results summary will therefore be skipped. Update that consumer to aggregate the glob, or upload a compatible consolidated report.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test_native.yml around lines 157 - 179, The test workflow
no longer preserves the testreport.xml contract expected by the downstream
consumer. Update the “Save test results” step or the corresponding consumer in
pr_tests.yml to aggregate or otherwise provide all testreport-*.xml files as the
compatible testreport.xml input, while retaining the detailed-results summary
behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/test_native.yml:
- Around line 157-179: The test workflow no longer preserves the testreport.xml
contract expected by the downstream consumer. Update the “Save test results”
step or the corresponding consumer in pr_tests.yml to aggregate or otherwise
provide all testreport-*.xml files as the compatible testreport.xml input, while
retaining the detailed-results summary behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6a19ba0d-af74-4183-affe-59e579edf1cf

📥 Commits

Reviewing files that changed from the base of the PR and between 5548bd3 and 4906f8a.

📒 Files selected for processing (1)
  • .github/workflows/test_native.yml

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

⚡ Try this PR in the Web Flasher

Flash this PR in the Web Flasher

firmware commit boards expires

Warning

This is an automated, unreviewed CI test build. Back up your device configuration
before flashing, and only flash devices you are able to recover.

Supported boards built by this PR (30)
Device Board Platform
Crowpanel Adv 3.5 TFT elecrow-adv-35-tft esp32-s3
Heltec HT62 heltec-ht62-esp32c3-sx1262 esp32-c3
Heltec Mesh Node 096 heltec-mesh-node-t096 nrf52840
Heltec Mesh Node T1 heltec-mesh-node-t1 nrf52840
Heltec Mesh Node T114 heltec-mesh-node-t114 nrf52840
Heltec V3 heltec-v3 esp32-s3
Heltec V4 heltec-v4 esp32-s3
Meshnology W10 meshnology_w10 esp32-s3
Raspberry Pi Pico pico rp2040
Raspberry Pi Pico W picow rp2040
RAK WisMesh Pocket V3 rak_wismesh_pocket nrf52840
RAK WisMesh Pod rak_wismesh_pod nrf52840
RAK WisMesh Repeater Mini V2 rak_wismesh_repeater_mini nrf52840
RAK WisMesh Tag rak_wismeshtag nrf52840
RAK WisBlock 11200 rak11200 esp32
RAK WisBlock 11310 rak11310 rp2040
RAK3312 rak3312 esp32-s3
RAK WisBlock 4631 rak4631 nrf52840
Seeed SenseCAP Mesh-Tracker-X1 seeed_mesh_tracker_X1 nrf52840
Seeed Wio Tracker L1 seeed_wio_tracker_L1 nrf52840
Seeed Xiao NRF52840 Kit seeed_xiao_nrf52840_kit nrf52840
Seeed Xiao ESP32-S3 seeed-xiao-s3 esp32-s3
Station G2 station-g2 esp32-s3
Station G3 station-g3 esp32-s3
LILYGO T-Deck t-deck-tft esp32-s3
LILYGO T-Echo t-echo nrf52840
LILYGO T-Echo Plus t-echo-plus nrf52840
LILYGO T-Impulse Plus t-impulse-plus nrf52840
LilyGo T3-C6 tlora-c6 esp32-c6
Seeed SenseCAP T1000-E tracker-t1000-e nrf52840

Build artifacts expire on 2026-08-20. Updated for dfee95c.

@caveman99
caveman99 requested a review from vidplace7 July 21, 2026 19:27
@caveman99

Copy link
Copy Markdown
Member Author

Good catch, fixed in the latest commit.

The per-area split was only meant to make the logs readable; I unintentionally also split the JUnit report, breaking the single-file testreport.xml contract that pr_tests.yml (and this workflow's own Test Report step) read.

The per-area runs still write testreport-<area>.xml, but a new merge step now folds them into a single testreport.xml (one <testsuites> root with every suite's <testsuite>), and that consolidated file is what gets uploaded. So pr_tests.yml:84 finds testreport.xml and its detailed summary runs unchanged, and generate-reports is back to the singular testreport.xml for its sed + dorny steps. The merge runs if: always() so a failing run still produces the report.

Verified the merge preserves the downstream parse: two area files with three suites merge to one root, and .//testsuite sums to the right totals and failure count.

@thebentern
thebentern merged commit 1d6f8a8 into develop Jul 22, 2026
104 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

github_actions Pull requests that update GitHub Actions code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants