ldb cmocka tests

Andreas Schneider asn at samba.org
Fri Apr 7 09:01:29 UTC 2017


On Thursday, 6 April 2017 23:39:44 CEST Andrew Bartlett wrote:
> On Thu, 2017-04-06 at 17:04 +1200, Andrew Bartlett via samba-technical
> 
> wrote:
> > On Tue, 2017-04-04 at 17:55 +0200, Andreas Schneider wrote:
> > > 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.
> > 
> > I thought I was using that, I tried to install a copy from source. 
> > 
> > As correct cmocka versions are not yet widely installed in
> > distributions, would it make sense to put it in third_party?  It
> > would
> > be very helpful if the right version was in the tree to test with.  
> > 
> > I don't like us having to bundle a lot of software, but if we want to
> > write tests in a framework, we should have the framework in our tree
> > or
> > available on all of current debian/ubuntu LTS/fedora.
> 
> I had tried to install cmokca from Debian Unstable, but that isn't
> recent enough.  However that was enough to break the test, as it
> doesn't link strongly against the version in /usr/local/lib.  I had to
> use LD_LIBRARY_PATH to override it.

This sounds like a waf issue, or you need to point pkg-config to the right 
location to find the newer version first.

Bundling will work for the cmocka tests we have in testsuite/unittest but I 
don't think it will work for a ldb build!


	Andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list