Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock static inline functions in a header file #938

Open
MichaelBMiner opened this issue Oct 11, 2024 · 1 comment
Open

Mock static inline functions in a header file #938

MichaelBMiner opened this issue Oct 11, 2024 · 1 comment

Comments

@MichaelBMiner
Copy link

I am writing tests for code written on an MXCA153 NXP dev kit. I am writing tests for my led module and running into the following.

Linking test_led.out...
/bin/ld: build/test/out/c/test_led.o: in function test_led_init': /mnt/YoctoDrive/Documents/michael/hand-held-stop-sign/hand-held-stop-sign/test/test_led.c:37: undefined reference to RESET_ReleasePeripheralReset_Expect'
/bin/ld: /mnt/YoctoDrive/Documents/michael/hand-held-stop-sign/hand-held-stop-sign/test/test_led.c:38: undefined reference to RESET_ReleasePeripheralReset_Expect' /bin/ld: /mnt/YoctoDrive/Documents/michael/hand-held-stop-sign/hand-held-stop-sign/test/test_led.c:40: undefined reference to RESET_ReleasePeripheralReset_Expect'
/bin/ld: /mnt/YoctoDrive/Documents/michael/hand-held-stop-sign/hand-held-stop-sign/test/test_led.c:41: undefined reference to `RESET_ReleasePeripheralReset_Expect'

Now the function RESET_ReleasePeripheralReset is implemented in fsl_reset.h as

static inline void RESET_ReleasePeripheralReset(reset_ip_name_t peripheral)
{
    RESET_SetPeripheralReset(peripheral);
}

This function is never mocked in mock_fsl_reset.c or mock_fsl_reset.h

In the project.yml if I add the setting :treat_inlines: :include I believe my issue would be resolved, but then it gives me a new error which I posted in 933

@mkarlesky
Copy link
Member

@MichaelBMiner So sorry about this. From your previous post #933, it appears you're using Ceedling 0.31.1. Ceedling 0.31.1 does indeed have a problem working with CMock's abilities to handle mocking inline functions. Would you be willing to try the latest Ceedling 1.0.0 prerelease instead (it also includes the latest CMock)? All the documentation you'll need including breaking changes and a cheat sheet for project configuration changes are linked from the release listing. All the issues you're experiencing should be resolved in 1.0.0. 1.0.0 is on the cusp of being published as an official release. The last big hurdle was recently cleared. We're working on some final tweaks and testing. When 1.0.0 is released, 0.31.1 will no longer be supported — in part, because it is incompatible with the most widely used version of Ruby and, in part, because we do not have the resources to support two versions simultaneously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants