Repository navigation
ESP32 WiFi modules: host tests of the UART interrupt handler - #1077
Conversation
software/wifi/tests: the handler of my_uart.c (raw_u64, raw_c3, u64ctrl) is cut out of each module as it is and run against a modelled UART and the real buffer queues of software/io/uart/cmd_buffer.c. No hardware, no ESP-IDF; `make isr`. A fix adds its own isr_<fix>_test.cpp and its models to the Makefile (`make isr-red`). First cases: a frame is delivered whole, escapes are decoded, a frame in pieces is delivered once, a queued frame goes out at the TX interrupt. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
GideonZ#1041 (wifi-fixes) adds its own software/wifi/tests; the two trees would collide on Makefile and stub/. Nothing else changes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Two fixes edited the same lines of the Makefile; each now adds a file, and the Makefile includes isr_*.mk. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The CI step "make host_tests" runs the other host suites; this one is added to it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eonZ#1077) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…1078) Brings in GideonZ#1077 (updated onto master). Module IDENT renumbered after master: raw_u64 1.19, raw_c3 1.12, u64ctrl 1.30. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Brings in GideonZ#1078 and GideonZ#1077 (updated onto master). Module IDENT renumbered after master and GideonZ#1078: raw_u64 1.20, raw_c3 1.13, u64ctrl 1.31. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
chrisgleissner
left a comment
There was a problem hiding this comment.
@JC-000 thanks for the harness. I re-reviewed it at head 6dcfbbb and am approving it.
Reviewed: the whole diff (test-only: software/wifi/uart_tests/ and one line in the top-level Makefile). No firmware file changes, so no device run is needed for this PR; the module changes that use the harness are #1078 and #1079, and they get their own hardware runs.
Host results at head 6dcfbbb (Ubuntu, g++):
make -C software/wifi/uart_tests isr: 4 tests pass for each of raw_u64, raw_c3 and u64ctrl.make isr-reddoes nothing at this head, becauseISR_RED_FIXESis empty (Makefile:30). That is expected: the red models arrive with #1078 and #1079.- To show the cases can fail, I broke the handler on purpose (not committed): in raw_u64
my_uart.c, the TX fill loop conditionfill_len > 2changed tofill_len > 2000.a_queued_frame_goes_out_at_the_tx_interruptthen fails atisr_test.cpp:60. - CI
buildis green on this head, and GitHub reports the PR as mergeable with master 18bea13.
Non-blocking, for a later change: escaped_end_and_escape_bytes_are_decoded checks only the frame size (5), not the decoded bytes. With the 0xDB 0xDC case in raw_u64 changed to decode to 0x00 instead of 0xC0, all four cases still pass. isr_received() could also hand back the data so the case can compare 01 C0 02 DB 03. Two comments name files that do not exist in this directory: stub/freertos/FreeRTOS.h mentions module_stubs.c, and cmdbuf_queues.h mentions cmdbuf_test.cpp.
The description says Fixes #1074, so the merge will close #1074 although the fixes are in #1078 and #1079. I will reopen #1074 after the merge so it stays open until #1079 lands.
Fixes #1074
Problem
The UART interrupt handler of the ESP32 modules (
my_uart.c, identical in raw_u64, raw_c3 and u64ctrl) has no test, so fixes to it cannot be shown red/green without a device. This adds a host harness: the handler is cut out of each module unchanged and run against a model of the UART, with the realcmd_buffer.cqueues; no ESP-IDF needed.What changed and why
New directory
software/wifi/uart_testswith the harness and four first cases (a frame is delivered whole; escapes are decoded; a frame in pieces is delivered once; a queued frame goes out at the TX interrupt), wired intomake host_tests. A fix adds its own test file andisr_<fix>.mkwith red models. The directory is separate fromsoftware/wifi/teststhat #1041 adds, so the two do not collide. The two module behaviour fixes for this issue — the RX-overflow resync and the TX-FIFO fill — build on this harness, so this PR goes in first.Products. the ESP32 WiFi modules: raw_u64 (Ultimate 64 / Ultimate 64 Elite), raw_c3 (Ultimate-II+L) and u64ctrl (Ultimate 64 Elite II / C64 Ultimate); the same
my_uart.cis in all three. Tests only, no firmware change.How I tested it
Host: macOS, with the device-free tests run in an Ubuntu 24.04 container (g++ 13.3). The hardware runs used the test harness from the same machine.
Host tests (device-free, run before and after the change):
my_uart.ccut out as it is and run against a modelled UART and the real buffer queues:make -C software/wifi/uart_tests isrmake isr-redis empty until a fix adds its modelsHardware.
None: tests only.
Standard profile / soak: not reported here — this change is module-side (ESP32) firmware, which the host-driven
./run-testsstandard profile and soak suites do not exercise. The module build is flashed and checked on its own (see above).Untested
Written with Claude Opus 5.5 in Claude Code.