Why does Unity test on Platform IO fail with ".pio/libdeps/native/Unity/src/unity_internals.h:11:10: fatal error: 'unity_config.h' file not found"

Viewed 21

I'm new to PlatformIo, Unity and Arduino/Esp32. I'm following this tutorial. When I run the build via Code, I get this message:

Processing native (platform: native)
--------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
LDF: Library Dependency Finder -> <redacted>
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 2 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Unity @ 2.5.2
Building in release mode
Compiling .pio/build/native/src/main.o
Compiling .pio/build/native/lib9be/Unity/unity.o
In file included from .pio/libdeps/native/Unity/src/unity.c:7:
In file included from .pio/libdeps/native/Unity/src/unity.h:21:
.pio/libdeps/native/Unity/src/unity_internals.h:11:10: fatal error: 'unity_config.h' file not found
#include "unity_config.h"
         ^~~~~~~~~~~~~~~~
1 error generated.
*** [.pio/build/native/lib9be/Unity/unity.o] Error 1
=============================================== [FAILED] Took 0.71 seconds ===============================================

I don't see the missing file mentioned in the tutorial. And I'm unclear on my path forward. Here is my code (basically right from the tutorial):

/test/test_circular_buffer.c


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

void setUp(void) {
    // set stuff up here
}

void tearDown(void) {
    // clean stuff up here
}

void test_circular_buffer_empty_after_init() {
    cbuffer_t buff;

    cbuffer_init(&buff);

    TEST_ASSERT_TRUE(cbuffer_empty(&buff));
}

void test_circular_buffer_not_empty_after_new_element_added() {
    cbuffer_t buff;
    cbuffer_init(&buff);

    cbuffer_add(&buff, 100);

    TEST_ASSERT_FALSE(cbuffer_empty(&buff));
}



int main( int argc, char **argv) {
    UNITY_BEGIN();

    RUN_TEST(test_circular_buffer_empty_after_init);

    UNITY_END();
}

/src/main.c

#include <stdio.h>

int main()
{
    printf("Hello World from PlatformIO!\n");
    return 0;
}

/platformio.ini

[env:native]
platform = native
lib_deps = throwtheswitch/Unity@^2.5.2
0 Answers
Related