ldb cmocka tests

Andrew Bartlett abartlet at samba.org
Thu Apr 6 21:39:44 UTC 2017


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. 

Andrew Bartlett

-- 
Andrew Bartlett
https://samba.org/~abartlet/
Authentication Developer, Samba Team         https://samba.org
Samba Development and Support, Catalyst IT   
https://catalyst.net.nz/services/samba







More information about the samba-technical mailing list