Avoid including failing dependencies

Hi, I’m currently working in an stm32 project using the stm32cube framework. I have a lot of libraries generated from the stm32cubemx program, between these some LoRa libraries, I’m currently writing a library to implement a custom communication protocol that will run on top of LoRa. I want to use test driven development to write this library and I am using the Unity testing suite in the native environment to write the test for this. Since Unity does not support mocking in platformio I created some fake lora libraries and I would like to include them only during the native test, I added build_flag = -DPIO_TEST in the platformio.ini in the native environment and inside the custom library .h file I have an ifdef block as following

#ifdef PIO_TEST
#include fake_radio.h
#include radio.h

This errors because radio.h has dependencies that fail to compile in the native environment, how could I achieve to include fake_radio.h if I’m running tests in the native environment and include radio.h if I’m compiling the code for uploading/debugging in the embedded chip.

Thanks in advance for any tip on how to achieve this.

try the “plus” mode for ifdefs:

Thanks for the quick answer, I tried chain+ and deep+ and both errors in the same way, particulary because in some of the includes of the radio.h or the files that it includes there is an #include “stm32wlxx_hal.h” and platformio can’t find it for native