On 11/25/2014 02:13 PM, Lukas Slebodnik wrote:
On (20/11/14 11:25), Lukas Slebodnik wrote:
> I was not able to mock functions with linker flang -wrap when
> they was called indirectly by another function from dynamic library.
> (It works with dirrect invocation of function)
> mc_client_tests_LDFLAGS = \
> -Wl,-wrap,sss_nss_check_header \
> -Wl,-wrap,sss_open_cloexec \
> This is a reason why I wrote mocked function in unit test
> If you know better way how to mock functions I will be glad to change test.
Attached are patches which fix warning caused by change in structure
src/tests/cmocka/test_mc_client.c:49:41: error: missing initializer for field
‘active_threads’ of ‘struct sss_cli_mc_ctx’ [-Werror=missing-field-initializers]
In file included from ../sssd/src/tests/cmocka/test_mc_client.c:36:0:
src/sss_client/nss_mc.h:58:14: note: ‘active_threads’ declared here
uint32_t active_threads; /* count of threads which use memory cache */
cc1: all warnings being treated as errors
I reintroduced the race condition in mmap cache
and the test failed. With fixed mmap cache the
Please add some comments to the function
test_client_reinit_race_condition. I know this
is just a test, but the code looks a little messy
to me without comments.
Also please remove this comment:
/* Even though normally the tests should clean up after themselves
* they might not after a failed run. Remove the old db to be sure */
because we do not remove any old db there.
Otherwise it looks good to me.