API exerciser

July 19, 2026 · View on GitHub

A generic host+CP example that exposes the native eh_host_* API surface as console commands, so functional API coverage is added as data (a console command + an expected line) rather than a new example per scenario.

Supported Platforms and Transports

Supported Coprocessors

CoprocessorESP32ESP32-C SeriesESP32-S Series
SupportYesYesYes

Supported Host Devices

Host DeviceESP32-P4ESP32-H2Other MCUsLinux
SupportYesYesYesYes

Supported Connection buses

Connection busSDIOSPI Full-DuplexSPI Half-DuplexUART
Linux hostYesYesNoNo
MCU hostYesYesYesYes

Directory layout

system/api_exerciser/
├── cp/                  ESP coprocessor firmware
├── mcu_host/            ESP-IDF MCU host app
└── linux_802_3_host/    Linux host
     └── c_app/          native C app

The result contract

Every command prints exactly one newline-terminated line:

EH rc=<int> cmd=<name> [k=v ...]
  • rc=0 on success; a non-zero rc (with err=<name>) on failure.
  • getters add fields (e.g. wifi_get_psEH rc=0 cmd=wifi_get_ps ps=2).
  • Round-trips (set → get → compare) and negative/arg-validation checks are expressed entirely in the test, not in firmware.

Type help at the eh> prompt for the full command list.

Run

# emulator (P4 host ⇄ C6 CP), via the pytest bench
python3 tools/eh.py test emu-mcu -k api_exerciser

Adding coverage

Add a row to mcu_host/main/eh_api_cmd.c's command table (one thin argv → eh_host_* call → eh_out(...) wrapper), then a pytest data file under tests/emu-mcu/eh_test_feat_api/. No emulator change is needed for the scalar/string API surface (SCENARIO_BACKLOG bucket B2).