The README has the quick-start commands; this page covers how the suites are organised and why.
cargo xtask test runs all host-side tests in sequence without hardware. They use standard cargo test and need no ESP toolchain.
| Crate | Covers | Command |
|---|---|---|
core-interface |
passes_filter, BLE/MQTT dispatch (platform_id gating, routing, source_device_id stamping, empty-source rejection), response routing, state publish split, CAN read-only flag and its change notifications, the CAN read-write policy (each condition blocking read-write, approval bound to one car, surviving a reboot and phone changes, relock conditions, bonded-phone-only BLE commands, MQTT never approving or unlocking, release builds without the dev lock, vehicle commands refused with the reason while read-only, the access state repeated while unchanged), the command requirements check (gate order, freshness, requirements, rejection responses that never block), the repeat limit (per command, from the last admitted run, after the requirements, not affecting availability), command availability (nothing before a report, read-only and old reports held back, publish on change, repeat and resend, MQTT basic commands only at the MQTT rate), per-bus CAN TX channels, SavvyCAN logging (GVRET parsing and encoding, session lifecycle, forced read-only), phone trust (vehicle commands and command frames needing a validated phone, validation sessions with code entry, in-car actions, attempts, cooldown and timeouts, validations bound to one car, who can change the approval or remove a validated phone, persistence and pruning to the bonds, the connected phone's access state), the deprecated CAN debug commands being ignored, BLE chunking and reassembly (chunk headers, CRC, MTU limits, gaps, duplicates, sequence mismatches, timeouts, oversize messages) |
cargo test -p core-interface -- --test-threads=1 |
virtual-car-controller |
encode_state proto encoding, worst-case state update fits the BLE message limit, CAN frame → state updates, process_basic_command, tick_simulation (initial defaults, ramp-up, park phase, odometer increment, door-lock preservation, cycle wraparound), the door lock refused while the simulated car drives and when pressed again inside its interval and sending a command frame for its phone, the simulated validation methods (button, cluster code), command availability and ids pinned to the wire |
cargo test -p virtual-car-controller -- --test-threads=1 |
egmp-controller |
New state publishes no invented values, worst-case state update fits the BLE message limit, decoding of real CAN frames (charge port, windows, hazards), charge port state through AC and DC sessions, battery power, range, charging times, charge limits, climate state, temperatures in both units, preconditioning states, battery temperatures and 12 V voltage, distance unit, regen mode and level, tire pressures, command requirements and availability from fixture states, command ids pinned to the wire | cargo test -p egmp-controller -- --test-threads=1 |
board-pc |
socketcan_to_core_frame / core_to_socketcan_frame round-trips, the CAN read-write approval and phone validations file formats, BLE helpers |
cargo test -p board-pc -- --test-threads=1 |
board-esp |
compute_mcp_masks, to_core_frame, CAN RX stats counters, the StoredBond and StoredApproval flash layouts and round-trips, BLE helpers (device name and fallback, random-static address detection), the short-boot count of the bond reset by power-cycling, the LTE modem's AT layer (reply parsing, the commands sent, the line reader against a scripted modem) |
cargo test -p board-esp -- --test-threads=1 |
--test-threads=1 is required — Embassy channels are process-global statics; parallel threads corrupt each other's state.
cargo xtask test --board esp --on-hardware
xtask generates .app_test_build/ (parallel to .app_build/), compiles it with the Xtensa toolchain using embedded-test 0.7 (features: external-executor, embassy-09, xtensa-semihosting, panic-handler) and flashes/runs via probe-rs run (invoked with sudo because the USB device is root:root in the dev container).
Test results are reported via semihosting — no defmt or RTT involved. The template (boards/esp/tests.template.rs) uses plain assert!/assert_eq! and includes channel round-trip and passes_filter smoke tests. Add custom on-device tests to boards/esp/tests/hardware.rs — xtask injects that file automatically.
See Architecture for how crates compile on the host for testing.
The test job in .github/workflows/ci.yml uses git diff to detect which crate directories changed and runs only the affected packages:
- Changes to
boards/pc/triggerboard-pctests. - Changes to
boards/esp/triggerboard-esptests. - Changes to
core-interface/trigger all four crates.
The build-and-lint job runs cargo xtask clippy and cargo xtask build for each board (esp, pc) and each affected vehicle platform, using config.toml.example. For esp it also lints and builds .github/ci/esp-lte-mtls.toml (an ESP32-S3 on LTE with MQTT over mTLS, with throwaway certificates), since the example config leaves the TLS code out. Clippy runs with -D warnings (also cargo clippy --package xtask in the lint job), so any lint fails CI. A platform is affected when its cars/<platform>/ directory changed. Changes to shared code (core-interface/, boards/, build-utils/, xtask/, hardware-profiles/, the contracts pin, the workspace Cargo.toml/Cargo.lock, config.toml.example or ci.yml) check every platform.
Their check names change with the platforms, so branch protection requires the summary Build & Lint job instead, which passes only when formatting, platform detection and every build-and-lint run passed (or no platform needed building).