ThrowTheSwitch / Ceedling

Ruby-based unit testing and build system for C projects
http://throwtheswitch.org
Other
596 stars 246 forks source link

Ceedling fails to find header file #933

Closed MichaelBMiner closed 1 month ago

MichaelBMiner commented 2 months ago

Hello,

I have been struggling with this for a bit now. I am trying to mock some headers for an NXP part MCXA154, there is a file fsl_romapi.h. This includes a few other headers as well. project.txt

I have attached my project.yml

My basic test is

#ifdef CEEDLING_TESTS

#include "unity.h"
#include "flash_storage.h"

#include "mock_MCXA153_features.h"
#include "mock_fsl_common.h"
#include "mock_fsl_romapi.h"
#include "mock_fsl_device_registers.h"
#include "mock_fsl_common_arm.h"
#include "mock_fsl_reset.h"
#include "mock_fsl_clock.h"

void setUp(void) {

}

void tearDown(void) {

}

void test_flash_storage_init_success(void) {
    flash_config_t flashDriver;
    FLASH_Init_ExpectAndReturn(&flashDriver, kStatus_Success);

    status_t status = flash_storage_init();

    TEST_ASSERT_EQUAL(kStatus_Success, status);
}

#endif

In my ceedling output I see

Creating mock for fsl_common... Creating mock for fsl_romapi... Creating mock for fsl_device_registers... WARNING: No function prototypes found! Creating mock for fsl_common_arm... In file included from include/flash_storage.h:12, from test/test_flash_storage.c:5: build/test/mocks/fsl_romapi.h:1:10: fatal error: frdm-mcxa153-bsp/drivers/fsl_common.h: No such file or directory 1 | #include "frdm-mcxa153-bsp/drivers/fsl_common.h"

All of my mocks are linking to the full file path rather than the relative paths. I am attaching pictures of my folder structure.

image image

Running an ls command from the same directory I run ceedling from I get

ls frdm-mcxa153-bsp/drivers/fsl_common* frdm-mcxa153-bsp/drivers/fsl_common_arm.c frdm-mcxa153-bsp/drivers/fsl_common_arm.h frdm-mcxa153-bsp/drivers/fsl_common.c frdm-mcxa153-bsp/drivers/fsl_common.h

Notice the files that cannot be found are there.

MichaelBMiner commented 1 month ago

Removing :treat_inlines: :include fixed my first issue.