# Bench tests for obu-firmware Scripts for testing the firmware on a real board (one micrOBU on a USB port) and for comparing a phone log with a second receiver's capture. The board tests are Python 3.11 with `pyserial` only (`asn1tools` is for the host replay check in [`../host`](../host/README.md), where the PC-side C tests live). **Which board:** the overnight run is for the **spare** XIAO ESP32-C5 (no cell), never the production OBU. It resets the board every time it opens the port, reconfigures it for hours and writes the demo ticket to its NVS. On the lab bench (2026-11-25): COM10 production OBU with the cell, **COM6 spare**, COM4 V2X node, COM8 simulated car (CH343). Plug only the spare into the home workstation; its port number there will differ, and `auto` finds it. A board without a cell still reports `battery_mv` of about 4000 (the USB charger node), so the battery reading cannot tell the boards apart. | Script | What it does | |---|---| | `start_overnight.ps1` | **the one command**: optionally builds and flashes this checkout (`-Flash`), starts the host C tests in the background, runs the board tests, keeps Windows awake | | `setup_workstation.ps1` | checks, and installs what is missing, for a PC that has to do all of the above (see "Setting up a workstation") | | `run_overnight.py` | the overnight run: schedules the stages below, watches for resets and heap leaks, writes the report. Refuses a board whose firmware is not this checkout's HEAD (`--allow-stale-firmware`) | | `bench_conformance.py` | stage 1: the link protocol against the spec and the firmware source, ~100 checks | | `bench_soak.py` | stage 2: transmit soak (unsigned, signed), capture-mode toggling, reconfiguration, idle listening, resets | | `bench_fuzz.py` | stage 3: seeded garbage on the link while the station is unconfigured (never on air) | | `linklib.py`, `itslib.py`, `bench_common.py` | the station-link client, a port of `gn_unwrap.c` and pcap reader, the result log | | `compare_phone_vs_node.py` | what the phone's V2X log missed against a pcap recorded at the same time | | `run_host_tests_overnight.ps1` | `make check` of `../host`, then the gn_unwrap fuzzer with new seeds until the time is up (needs MSYS2) | ## Overnight run on a board Close everything that holds the port first (phone app over USB, `station_status_watch.py`, a serial monitor): opening the port resets the board. ```powershell git pull powershell -ExecutionPolicy Bypass -File obu-firmware\test\bench\start_overnight.ps1 -Flash -Quick # about 8 minutes: does it all work? powershell -ExecutionPolicy Bypass -File obu-firmware\test\bench\start_overnight.ps1 -Flash -Hours 8 # the overnight run ``` `-Flash` builds this checkout and writes it to the board, so the run tests the code you are looking at (the first build downloads components and takes about 20 minutes). Add `-Port COM6` when more than one Espressif board is plugged in. Without `start_overnight.ps1`, the board part alone is `py -3.11 obu-firmware\test\bench\run_overnight.py COM6 --hours 8 --provision-demo`. Results go to `obu-firmware/test/results/overnight-