feat(modem): Add end2end host tests with host modem_sim#1041
Merged
david-cermak merged 4 commits intoespressif:masterfrom Apr 16, 2026
Merged
feat(modem): Add end2end host tests with host modem_sim#1041david-cermak merged 4 commits intoespressif:masterfrom
david-cermak merged 4 commits intoespressif:masterfrom
Conversation
acd1b89 to
8900887
Compare
c1997ae to
ac832bb
Compare
euripedesrocha
approved these changes
Apr 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add end-to-end host test with modem simulator
Adds a new
host_test_appundercomponents/esp_modem/test/that exercises the esp_modem AT command path end-to-end on a Linux host, using two cooperating processes connected over a TCP socket.The test consists of two parts:
modem_sim
A standalone C++ TCP server (no IDF dependency) that emulates a SIM7600-like modem. It listens on localhost, accepts connections, and responds to AT commands (AT+CSQ, AT+CGMM, AT+CGSN, AT+CIMI, AT+COPS?, AT+CPIN?, +++, etc.). Responses can be delivered in configurable batches (batch_size / batch_delay_ms) to simulate fragmented serial data arriving in chunks rather than complete lines.
test_app
An IDF Linux application (Catch2) that creates a VFS socket DTE via vfs_create_socket, instantiates a SIM7600 DCE through the standard esp_modem factory API, and runs AT command tests against the simulator. Seven test cases cover set_command_mode, get_signal_quality, get_module_name, get_operator_name, get_imsi, get_imei, and read_pin.
A
run_test.shharness script orchestrates both processes: builds the simulator if needed, starts it in the background, runs the test binary with a configurable timeout, and cleans up.esp_netif_linux stub mode
To avoid requiring a lwIP download for AT-only testing, the esp_netif_linux component's CMakeLists.txt now checks whether LWIP_PATH is set. If not, it registers a minimal stub (esp_netif_stub.c) providing only the headers and no-op implementations of esp_netif_new/esp_netif_destroy/esp_netif_receive, then returns early. The full lwIP+TUN build path is unchanged when LWIP_PATH is defined. This makes the existing host_test and linux_modem example unaffected while enabling lightweight test builds.
Note
Medium Risk
Introduces new CI-executed host tests and a conditional
esp_netif_linuxstub path, which could affect Linux build/link behavior when lwIP isn’t configured. Runtime impact should be limited to the Linux port and test scaffolding.Overview
Adds a new
components/esp_modem/test/host_test_append-to-end Linux host test that runs Catch2-based AT-command tests against a new standalone TCPmodem_simprocess, with arun_test.shharness and CI configs for the Linux target.Updates CI (
modem__build-host-tests.yml) to build and execute this host test across multiple IDF versions and run it under different response chunking settings to simulate fragmented modem I/O.Makes Linux builds less dependent on networking by adding an
esp_netif_linuxstub mode whenLWIP_PATHisn’t present (registeringesp_netif_stub.c), and introduces a small FreeRTOSportmacro.hshim for Linux critical-section/spinlock APIs.Reviewed by Cursor Bugbot for commit 63ccd09. Bugbot is set up for automated code reviews on this repo. Configure here.