mirror of
https://github.com/esphome/esphome.git
synced 2026-08-27 08:28:30 +00:00
Segment pool entries are 20 bytes on this build, not the nominal 16 that struct tcp_seg suggests; the comment now quotes the measured figure. The MEM_SIZE justification did not close as written: two connections at ~6KB each is ~12KB, which fits inside the old 16KB heap. The missing term is that mem.c is first-fit, so what has to be free is a contiguous 1.5KB block, and at 75% occupancy interleaved with ARP, DHCP/DNS and mDNS allocations the largest run collapses long before the total does. That is also why the failure looked intermittent. Spelled out in both the Python comment and the header template. Hoist the lwIP sizing values to module constants so the two numeric invariants can be tested: the segment pool must stay above the per-PCB send queue, and MEM_SIZE must stay under 64000 or lwIP widens mem_size_t to u32_t. Both were previously enforced by prose alone, and the first would silently rebuild the starvation this change removes. The generated header is byte identical.
Tests for ESPHome
This directory contains some tests for ESPHome.
At the moment, all the tests only work by simply executing
esphome over some YAML files that are made to test
whether the yaml gets converted to the proper C++ code.
Of course this is all just very high-level and things like unit tests would be much better. So if you have time and know how to set up a unit testing framework for python, please do give it a try.
When adding entries in test_.yaml files we usually need only
one file updated, unless conflicting code is generated for
different configurations, e.g. wifi and ethernet cannot
be tested on the same device.
Current test_.yaml file contents.
| Test name | Platform | Network | BLE |
|---|---|---|---|
| test1.yaml | ESP32 | wifi | None |
| test2.yaml | ESP32 | ethernet | esp32_ble_tracker |
| test3.yaml | ESP8266 | wifi | N/A |
| test4.yaml | ESP32 | ethernet | None |
| test5.yaml | ESP32 | wifi | ble_server |
| test6.yaml | RP2040 | wifi | N/A |
| test7.yaml | ESP32-C3 | wifi | N/A |
| test8.yaml | ESP32-S3 | wifi | None |
| test10.yaml | ESP32 | wifi | None |