I am not sure if this is the right place to share this, but I ran into an interesting issue with using platformio test and unity with the lolin_s2_mini board. I have a simple workaround, but it seems like there is a possible fix?
Problem
The unity test output is not sent to the serial port, so the test runner doesn’t work
Apparent Cause
The basic issue is the esp32s2 framework contains a unity_config.h in framework-arduinoespressif32/tools/sdk/esp32s2/include/unity/include, and this is being picked up first in the build.
This default config file directs the unity output to stdout, and not the serial port where it needs to go.
The auto-generated unity_config.h file in .pio/build/lolin_s2_mini/unity_config is correct
Why Does This Happen?
The problem seems to be when compiling .pio/libdeps/lolin_s2_mini/Unity/src/unity.c, the include file paths cause the wrong unity_config.h to be included. Interestingly, the include file paths when compiling the test file appear to be correct.
Workaround
Remove ~/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s2/include/unity/include/unity_config.h
platformio test works as expected.
Details
When compiling the test case, test/embedded/test_blink/blink.cpp, the include paths are as follows:
-Iinclude -Isrc -I.pio/libdeps/lolin_s2_mini/Unity/src -I.pio/build/lolin_s2_mini/unity_config … etc
When compiling .pio/libdeps/lolin_s2_mini/Unity/src/unity.c (which needs the unity_config.h), the include paths are as follows:
-I.pio/libdeps/lolin_s2_mini/Unity/src -I/home/jim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32s2/include/unity/include -I.pio/build/lolin_s2_mini/unity_config … etc
Possible Fix
It seems that changing the include path when compiling unity.c would address the issue.