PlatformIO Community

Platformio espressif32 cannot build test due to include error

Description of problem

A platformio projects with esp32 ‘components’

  • components/comp1/comp1.h
  • components/comp1/comp1.c

compiles without any problem with pio run -e mydebug
I created a file test_comp.c in directory test

#include "comp1.h"
#include <unity.h>

void test_function_comp_reset() {

TEST_ASSERT_EQUAL(50, 2*102*10);

}

void app_main() {

UNITY_BEGIN();

RUN_TEST(test_function_comp_reset();

UNITY_END();

}

pio test complains about missing header file

#include "comp1.h"
^~~~~~~~~~~~~~~~~~~
compilation terminated.
[env]
platform = espressif32
board = mhetesp32minikit
framework = espidf
monitor_speed = 115200

[env:mydebug]

test_build_project_src = yes
debug_tool = esp-prog
debug_init_break = tbreak app_main
; release is default
build_type = debug

If you refactor the component to a PlatformIO library in lib/comp1 etc. (just move the sources) it will probably work. But please report this as a bug in https://github.com/platformio/platform-espressif32/issues because it should respect the components in a ESP-IDF build.