[SSSD] [PATCH] RFC: Unit test for the NSS responder based on the cmocka library

Jakub Hrozek jhrozek at redhat.com
Fri Mar 1 13:01:24 UTC 2013


On Fri, Mar 01, 2013 at 01:39:22PM +0100, Pavel Březina wrote:
> >[1] http://cmocka.cryptomilk.org/
> 
> Very nice.
> 
> I would like to increase granularity though. First of all we should
> separate cmocka test files from check files on directory/filename
> level. I'd say that all cmocka stuff should go into tests/cmocka. For
> example, there are files common_check.c, common_dom.c, common.c, but
> only common_dom.c is suitable for cmocka. When more common files and
> tests comes, it will be hard to distinguish them.
> 
> Testing with cmocka is mainly about mocking structures and creating
> wrappers around functions. We should try to create reusable mocks and
> wrappers right from the beginning, making them independent on tests.
> For example: mock_rctx(), mock_cctx(), sss_dp_get_account_send(),
> sss_dp_get_account_recv(), ... I believe these and more functions can
> be reused when testing other responders so they should be placed in
> e.g. common_responder.c
> 

Definitely. As I said in the original mail, I didn't want to spend too
much time without getting some kind of feedback.

I will move the definitions to some common file and resubmit.

> Why did you include setjmp.h?

I will add a comment to clarify this.



More information about the sssd-devel mailing list