hf-core uses an ESP32-based testing infrastructure that mirrors the pattern used by
all external HardFOC drivers. Each test is a standalone ESP-IDF application selected
at build time via the APP_TYPE mechanism.
cd examples/esp32/scripts
./build_app.sh as5047u_handler_test Debug
Using idf.py directly
1
2
3
4
cd examples/esp32
export APP_TYPE=general_utils_test
export BUILD_TYPE=debug
idf.py build
Using VS Code ESP-IDF Extension
Set APP_TYPE environment variable in your workspace settings
Use the ESP-IDF build command
Flashing and Monitoring
1
idf.py -p /dev/ttyUSB0 flash monitor
Pin Configuration
Pin assignments are defined in esp32_test_config.hpp and can be overridden with
compile-time -D flags. See the file for the complete pin map.
Test Framework
All tests use TestFramework.h — a shared header providing:
RUN_TEST(name, fn) — Run a test function, track pass/fail
RUN_TEST_IN_TASK(name, fn, stack, timeout) — Run in a FreeRTOS task with timeout
RUN_TEST_SECTION_IF_ENABLED(flag, name, ...) — Conditionally run test groups
flip_test_progress_indicator() — Toggle GPIO14 for visual progress
print_test_summary(results, name, tag) — Print final pass/fail report
Writing New Tests
Follow the existing pattern:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include"TestFramework.h"staticTestResultsg_test_results;staticbooltest_my_feature()noexcept{// ... test logic ...returnsuccess;}extern"C"voidapp_main(void){RUN_TEST("my_feature",test_my_feature);print_test_summary(g_test_results,"MY TEST SUITE","MyTag");while(true){vTaskDelay(pdMS_TO_TICKS(10000));}}
Then add the app to app_config.yml and update main/CMakeLists.txt.