CMock with ThreadX

99 views
Skip to first unread message

Paul

unread,
Feb 10, 2021, 8:40:36 PM2/10/21
to ThrowTheSwitch Forums
CMock doesn't seem to use the C pre-processor (cpp) when generating mocks.  For instance, ThreadX stupidly does a:
#define VOID void
and if there is a function with this as a return code, such as:
    VOID tx_application_define(VOID *first_unused_memory); 
CMock will try and create mocks that allow the user to return a type VOID.  The compiler will error out on this return of a void.

Michael Karlesky

unread,
Feb 10, 2021, 8:51:08 PM2/10/21
to throwth...@googlegroups.com

That’s correct. CMock does not use the C preprocessor.

However,
  1. CMock is configurable and can replace simple tokens with other types. In a simple case such as with a VOID define it could be configured to replace it as you need.
  2. Ceedling does offer an option to run the C preprocessor on the input to CMock. Ceedling is a build tool built atop Rake specific to managing C test builds using Unity and CMock.
    1. A few people have provided tutorials online for setting up a new project. Here’s an example: http://www.electronvector.com/blog/getting-started-with-ceedling-creating-a-new-project
    2. The easiest way to get started is using a Docker image that includes all the tools and a gun C toolchain. See the last entry here: http://www.throwtheswitch.org/tools


On Feb 10, 2021, at 8:40 PM, Paul <paulg...@gmail.com> wrote:

CMock doesn't seem to use the C pre-processor (cpp) when generating mocks.  For instance, ThreadX stupidly does a:
--
You received this message because you are subscribed to the Google Groups "ThrowTheSwitch Forums" group.
To unsubscribe from this group and stop receiving emails from it, send an email to throwtheswitc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/throwtheswitch/05cf49f7-ec86-4b92-9f3e-ef98e8ce03f4n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages