I am having an issue where I build a file in a test environment and am testing for the presence of the macro UNIT_TEST in a library and have a different size of global variables depending on if the macro is defined or not.
If I check for the define using a codesnippet like this, I get both manually-placed warnings during compilation using pio test, ARENA_SIZE is 200 in the end and the linker tells me that SRAM overflows because of it:
#ifdef UNIT_TEST
#warning "unit test active"
#define ARENA_SIZE 100
#else
#warning "unit test not active"
#define ARENA_SIZE 200
#endif /* ifdef UNIT_TEST */
uint8_t arena[ARENA_SIZE];
I am using a fork of platformio-core that has an additional target __test to generate a compiledb for the test-dir (#5480). I don't know whether this is an issue of platformio-core as-is, or if it is an issue with the branch, so I am creating the issue here and am mentioning the PR.
I expect the ARENA_SIZE to be 100 while compiling and linking.
I am having an issue where I build a file in a test environment and am testing for the presence of the macro
UNIT_TESTin a library and have a different size of global variables depending on if the macro is defined or not.If I check for the define using a codesnippet like this, I get both manually-placed warnings during compilation using
pio test,ARENA_SIZEis 200 in the end and the linker tells me that SRAM overflows because of it:I am using a fork of platformio-core that has an additional target
__testto generate a compiledb for thetest-dir (#5480). I don't know whether this is an issue of platformio-core as-is, or if it is an issue with the branch, so I am creating the issue here and am mentioning the PR.I expect the
ARENA_SIZEto be 100 while compiling and linking.