cmocka: Add will_return_maybe() for ignoring mock returns

As both parameter and function call order checking allow for ignoring
cases where they are never invoked, the mock return values are at
somewhat of a mismatch in that they must always be returned at least
once (even in the case of will_return_always()). Therefore, the ability
to set the count to -2 on will_return_count was added with a new macro
(will_return_maybe) that indicates that that the value field may never
be returned and still allow a successful test.

Reviewed-by: Andreas Schneider <>
6 files changed