This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

CMock Failed Parsing Declaration Prototype

Hello guys, looking forward to some help here!

I've been working on a Unit Test system setup with CMock + Unity for a BLE app. But when I try CMocking some headers in the nrf sdk(eg. nrf_erratas.h), I get a "Failed Parsing Declaration Prototype" Error from the cmock_header_parser.rb script. 

From what I've seen so far, it seems as if CMock has issues with Macros and static inline functions. And I found this post:

https://devzone.nordicsemi.com/f/nordic-q-a/54255/how-did-nordic-mock-headers-like-app_timer-h-with-many-dependencies

Which explains quite well what to do. But I don't understand where should I put the newly created ".h" file? Because the file that was linked to nrf_erratas.h will still include it, unless I mess with the SDK directly. So a bit of a walkthrough for dummies would be great.

Also, I am trying to do this with Makefiles. In your example here:

https://github.com/nrfconnect/sdk-nrf/blob/master/tests/unity/CMakeLists.txt

I saw you did it with CMake. Is it your suggestion to switch over to the CMakeLists?

Anyway, thanks a lot for reading this. This seems like a great community and I hope we will have fun together in the future!

Parents Reply Children
  • If that is the case, I won't be able to help you much. We are using cmock in nrf5 sdk and we did some modifications but they are coupled with our internal test frameworks and cannot be easily shared. You can try to take the path from nRF Connect SDK where instead of modifying cmock we are pre-parsing header file and fix things there, e.g. convert static inlines to function declarations. Then, in the test this artificial header should be used instead of original one.

Related