ldb cmocka tests

Andreas Schneider asn at samba.org
Tue Apr 4 15:55:12 UTC 2017


On Monday, 3 April 2017 04:57:23 CEST Andrew Bartlett wrote:
> Some more review!

Thanks for the review.

> In ldb:tests: Build a ldb test for the tdb backend
> 
> Can you clarify this hunk:
> 
> +    conf.SET_TARGET_TYPE('cmocka', 'EMPTY')
> +
> +    conf.env.found_cmocka = False
> +    if conf.CHECK_CFG(package='cmocka',
> +                      args='"cmocka >= 1.1.0" --cflags --libs',
> +                      msg='Checking for cmocka >= 1.1.0'):
> +        conf.CHECK_LIB('cmocka', shlib=True)
> +        #conf.CHECK_FUNCS_IN('_cmocka_run_group_tests', 'cmocka')
> +        conf.env.found_cmocka = True
> +
> 
> I'm presuming we should drop this line:
> #conf.CHECK_FUNCS_IN('_cmocka_run_group_tests', 'cmocka')
> 

I removed that.

> 
> In "ldb:tests: Add a test for ldb transactions" I hate to have to
> comment on whitespace given recent discussions, but this isn't using
> our standard 8-space tabs, and (even more importantly) isn't in line
> with the rest of the file.

Fixed.

> In "ldb:tests: unit test for ldb_search()" it really should check both
> with and without the checkBaseOnSearch attribute on @OPTIONS, as this
> changes the behaviour quite a bit.

I hope I implemented that correctly with Jakub. There is a new test:

	test_search_match_basedn

> In "ldb:tests: Unit test the ldb_rename() operation" I agree with the
> FIXME, the rename with no change case really should be checked.

...

> In "ldb:tests: Print subunit output", should we include this in the
> Samba test as well?  Otherwise, I'm not sure what the point of the
> subunit output is, as ldb is currently only using the return value.

I removed it. If autobuild runs this testsuite the standard cmocka test output 
is a bit nicer.

> In any case, the tests fail with:
> Python testsuite returned 0
> test: test_connect
> success: test_connect
> test: (null)
> Aborted
> Makefile:15: recipe for target 'test' failed
> make: *** [test] Error 134
> 
> for me.

It works just fine for me. You can also just run:

./bin/ldb_tdb_mod_op_test

gdb ./bin/ldb_tdb_mod_op_test

if it aborts to get a backtrace. You should use cmocka 1.1.0.

> Finally, we probably should get current cmocka on sn-devel before we
> push this.

That would be great.


Patch attached.


	Andreas


-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libldb_cmocka_tests.patch
Type: text/x-patch
Size: 70817 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170404/1608e62c/libldb_cmocka_tests.bin>


More information about the samba-technical mailing list