docs: update test instructions to prefer bin/run-tests.sh; fix suite count to 19; add Copilot interface caveat

This commit is contained in:
nomdetom
2026-06-25 13:44:09 +01:00
parent b93239bb0a
commit 90f01c2b95
3 changed files with 52 additions and 18 deletions
+15 -1
View File
@@ -4,6 +4,20 @@ This directory contains C++ unit tests that run on the host machine via Platform
## Running Tests
**Preferred: use `bin/run-tests.sh`** — it runs the `coverage` env (ASan/LSan sanitizers), cross-checks the number of suites that actually ran, and emits an unambiguous RED/AMBER/GREEN verdict:
```bash
./bin/run-tests.sh # all suites
./bin/run-tests.sh -f test_traffic_management # single suite
./bin/run-tests.sh -f test_traffic_management > /tmp/test_out.txt 2>&1; tail -5 /tmp/test_out.txt
```
Exit codes: 0 = GREEN, 1 = RED, 2 = AMBER.
> **Copilot interface note:** When running tests via the Copilot chat interface, edits made through the chat may not be reflected in the on-disk files that the test binary reads. If tests pass in chat but fail locally (or vice versa), verify the files on disk match what you expect before trusting the result. Always confirm with a local terminal run.
**Raw `pio test` (no sanitizers, no verdict logic)** — use when you need to override the env or inspect verbose Unity output:
```bash
# All test suites
pio test -e native
@@ -17,7 +31,7 @@ pio test -e native -f test_your_module -vvv
**Never pipe through `| tail -N` to shorten output.** PlatformIO prints build errors at the top of output and test results at the bottom; `tail` will show stale cached results from a prior successful build while hiding the compile error that caused the current run to fail.
**Preferred pattern — redirect to file, then grep:**
**Preferred pattern for raw pio — redirect to file, then grep:**
```bash
# Redirect all output to a file; grep for errors and results after it exits