Closed MichaelBMiner closed 2 years ago
I think you've misdiagnosed the problem. I strongly suspect that it's a difference between versions of your standard linux header files on these platforms.
Your header suggests the struct in question is defined in linux/if_link.h
, but that's not included in the path of the mock. You might be able to work around this with the following:
:cmock:
:includes_h_pre_orig_header:
- linux/if_link.h
This will include the header file that contains the struct in each of your mocks. The problem, of course, is that if THAT has further dependencies, it may run into problems and you could get stuck including a bunch of stuff. In that case, it's usually best to define this struct yourself (either a real version of it, or a simplified test version of it if the contents aren't important). This can be done in a test_helper and then included.
You are 100% correct, the implementation of libsocketcan.h is very slightly different between the versions of Ubuntu.
The :cmock: include you have suggested unfortunately does not fix my issue. Redefining the struct in unity_helper.h did however solve the issue.
Thank you for your patience. This was an odd one for me!
Hello,
This is related to my question in ceedling, but it appears the issue is in CMock and not ceedling.
My issue is that I can run
ceedling clobber test:all
in Ubuntu 18.04 and not in Ubuntu 20.04. I have confirmed this by doing the following.ceedling clobber test:all
I did the same steps above but with an ISO of Ubuntu 18.04 (ubuntu-18.04.6-desktop-amd64.iso) When I run
ceedling clobber test:all
I see that all my tests run and build.I am attaching my project.yml and libsocketcan.h
project.txt libsocketcan.txt
Note that both VMs are running the same versions of ceedling, unity, cmock and cexception.
Edit: For completeness I am adding a test file that displays the error as well as a part of the c file used. test_can.c.txt can.c.txt