051c274f3c85b47eba448cd24f715d8ddf404fdc
[nivanova/samba-autobuild/.git] / lib / ldb / wscript
1 #!/usr/bin/env python
2
3 APPNAME = 'ldb'
4 VERSION = '1.6.2'
5
6 import sys, os
7
8 # find the buildtools directory
9 top = '.'
10 while not os.path.exists(top+'/buildtools') and len(top.split('/')) < 5:
11     top = top + '/..'
12 sys.path.insert(0, top + '/buildtools/wafsamba')
13
14 out = 'bin'
15
16 import wafsamba
17 from wafsamba import samba_dist, samba_utils
18 from waflib import Errors, Options, Logs, Context
19 import shutil
20
21 samba_dist.DIST_DIRS('''lib/ldb:. lib/replace:lib/replace lib/talloc:lib/talloc
22                         lib/tdb:lib/tdb lib/tdb:lib/tdb lib/tevent:lib/tevent
23                         third_party/popt:third_party/popt
24                         third_party/cmocka:third_party/cmocka
25                         buildtools:buildtools third_party/waf:third_party/waf''')
26
27 samba_dist.DIST_FILES('''lib/util/binsearch.h:lib/util/binsearch.h''')
28
29 def options(opt):
30     opt.BUILTIN_DEFAULT('replace')
31     opt.PRIVATE_EXTENSION_DEFAULT('ldb', noextension='ldb')
32     opt.RECURSE('lib/tdb')
33     opt.RECURSE('lib/tevent')
34     opt.RECURSE('lib/replace')
35     opt.load('python') # options for disabling pyc or pyo compilation
36
37     opt.add_option('--without-ldb-lmdb',
38                    help='disable new LMDB backend for LDB',
39                    action='store_true', dest='without_ldb_lmdb', default=False)
40
41
42 def configure(conf):
43     conf.RECURSE('lib/tdb')
44     conf.RECURSE('lib/tevent')
45
46     if conf.CHECK_FOR_THIRD_PARTY():
47         conf.RECURSE('third_party/popt')
48         conf.RECURSE('third_party/cmocka')
49     else:
50         if not conf.CHECK_POPT():
51             raise Errors.WafError('popt development packages have not been found.\nIf third_party is installed, check that it is in the proper place.')
52         else:
53             conf.define('USING_SYSTEM_POPT', 1)
54
55         if not conf.CHECK_CMOCKA():
56             raise Errors.WafError('cmocka development package have not been found.\nIf third_party is installed, check that it is in the proper place.')
57         else:
58             conf.define('USING_SYSTEM_CMOCKA', 1)
59
60     conf.RECURSE('lib/replace')
61     conf.find_program('python', var='PYTHON')
62     conf.find_program('xsltproc', var='XSLTPROC')
63     conf.load('python')
64     conf.check_python_version((2,4,2))
65     conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=not conf.env.disable_python)
66
67     # where does the default LIBDIR end up? in conf.env somewhere?
68     #
69     conf.CONFIG_PATH('LDB_MODULESDIR', conf.SUBST_ENV_VAR('MODULESDIR') + '/ldb')
70
71     conf.env.standalone_ldb = conf.IN_LAUNCH_DIR()
72
73     if not conf.env.standalone_ldb:
74         max_ldb_version = [int(x) for x in VERSION.split(".")]
75         max_ldb_version[2] = 999
76         max_ldb_version_dots = "%d.%d.%d" % tuple(max_ldb_version)
77
78         if conf.env.disable_python:
79             if conf.CHECK_BUNDLED_SYSTEM_PKG('ldb',
80                                              minversion=VERSION,
81                                              maxversion=max_ldb_version_dots,
82                                              onlyif='talloc tdb tevent',
83                                              implied_deps='replace talloc tdb tevent'):
84                 conf.define('USING_SYSTEM_LDB', 1)
85         else:
86             using_system_pyldb_util = True
87             dflt_name = 'pyldb-util' + conf.all_envs['default']['PYTHON_SO_ABI_FLAG']
88             if not conf.CHECK_BUNDLED_SYSTEM_PKG(dflt_name,
89                                                  minversion=VERSION,
90                                                  maxversion=max_ldb_version_dots,
91                                                  onlyif='talloc tdb tevent',
92                                                  implied_deps='replace talloc tdb tevent ldb'):
93                 using_system_pyldb_util = False
94
95             if using_system_pyldb_util:
96                 conf.define('USING_SYSTEM_PYLDB_UTIL', 1)
97
98             if conf.CHECK_BUNDLED_SYSTEM_PKG('ldb',
99                                              minversion=VERSION,
100                                              maxversion=max_ldb_version_dots,
101                                              onlyif='talloc tdb tevent %s' % dflt_name,
102                                              implied_deps='replace talloc tdb tevent'):
103                 conf.define('USING_SYSTEM_LDB', 1)
104
105     if not conf.CHECK_CODE('return !(sizeof(size_t) >= 8)',
106                            "HAVE_64_BIT_SIZE_T_FOR_LMDB",
107                            execute=True,
108                            msg='Checking for a 64-bit host to '
109                            'support lmdb'):
110         Logs.warn("--without-ldb-lmdb implied as this "
111                   "host is not 64-bit")
112
113         if not conf.env.standalone_ldb and \
114            not Options.options.without_ad_dc and \
115            conf.CONFIG_GET('ENABLE_SELFTEST'):
116             Logs.warn("NOTE: Some AD DC parts of selftest will fail")
117
118         conf.env.REQUIRE_LMDB = False
119     else:
120         if conf.env.standalone_ldb:
121             if Options.options.without_ldb_lmdb:
122                 conf.env.REQUIRE_LMDB = False
123             else:
124                 conf.env.REQUIRE_LMDB = True
125         elif Options.options.without_ad_dc:
126             conf.env.REQUIRE_LMDB = False
127         else:
128             if Options.options.without_ldb_lmdb:
129                 if not Options.options.without_ad_dc and \
130                    conf.CONFIG_GET('ENABLE_SELFTEST'):
131                     raise Errors.WafError('--without-ldb-lmdb conflicts '
132                                          'with --enable-selftest while '
133                                          'building the AD DC')
134
135                 conf.env.REQUIRE_LMDB = False
136             else:
137                 conf.env.REQUIRE_LMDB = True
138
139
140     if conf.CONFIG_SET('USING_SYSTEM_LDB'):
141         v = VERSION.split('.')
142         conf.DEFINE('EXPECTED_SYSTEM_LDB_VERSION_MAJOR', int(v[0]))
143         conf.DEFINE('EXPECTED_SYSTEM_LDB_VERSION_MINOR', int(v[1]))
144         conf.DEFINE('EXPECTED_SYSTEM_LDB_VERSION_RELEASE', int(v[2]))
145
146     if conf.env.standalone_ldb:
147         conf.CHECK_XSLTPROC_MANPAGES()
148
149         # we need this for the ldap backend
150         if conf.CHECK_FUNCS_IN('ber_flush ldap_open ldap_initialize', 'lber ldap', headers='lber.h ldap.h'):
151             conf.env.ENABLE_LDAP_BACKEND = True
152
153         # we don't want any libraries or modules to rely on runtime
154         # resolution of symbols
155         if not sys.platform.startswith("openbsd"):
156             conf.ADD_LDFLAGS('-Wl,-no-undefined', testflags=True)
157
158     # if lmdb support is enabled then we require lmdb
159     # is present, build the mdb back end and enable lmdb support in
160     # the tools.
161     if conf.env.REQUIRE_LMDB and \
162        not conf.CONFIG_SET('USING_SYSTEM_LDB'):
163         if not conf.CHECK_CFG(package='lmdb',
164                               args='"lmdb >= 0.9.16" --cflags --libs',
165                               msg='Checking for lmdb >= 0.9.16',
166                               mandatory=False):
167             if not conf.CHECK_CODE('''
168                     #if MDB_VERSION_MAJOR == 0 \
169                       && MDB_VERSION_MINOR <= 9 \
170                       && MDB_VERSION_PATCH < 16
171                     #error LMDB too old
172                     #endif
173                     ''',
174                     'HAVE_GOOD_LMDB_VERSION',
175                     headers='lmdb.h',
176                     msg='Checking for lmdb >= 0.9.16 via header check'):
177
178                 if conf.env.standalone_ldb:
179                     raise Errors.WafError('ldb build (unless --without-ldb-lmdb) '
180                                          'requires '
181                                          'lmdb 0.9.16 or later')
182                 elif not Options.options.without_ad_dc:
183                     raise Errors.WafError('Samba AD DC and --enable-selftest '
184                                          'requires '
185                                          'lmdb 0.9.16 or later')
186
187         if conf.CHECK_FUNCS_IN('mdb_env_create', 'lmdb', headers='lmdb.h'):
188             conf.DEFINE('HAVE_LMDB', '1')
189             conf.env.HAVE_LMDB = True
190
191
192     conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
193
194     conf.SAMBA_CONFIG_H()
195
196     conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
197
198 def build(bld):
199     bld.RECURSE('lib/tevent')
200
201     if bld.CHECK_FOR_THIRD_PARTY():
202         bld.RECURSE('third_party/popt')
203         bld.RECURSE('third_party/cmocka')
204
205     bld.RECURSE('lib/replace')
206     bld.RECURSE('lib/tdb')
207
208     if bld.env.standalone_ldb:
209         if not 'PACKAGE_VERSION' in bld.env:
210             bld.env.PACKAGE_VERSION = VERSION
211         bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
212         private_library = False
213     else:
214         private_library = True
215     # we're not currently linking against the ldap libs, but ldb.pc.in
216     # has @LDAP_LIBS@
217     bld.env.LDAP_LIBS = ''
218
219     LDB_MAP_SRC = bld.SUBDIR('ldb_map',
220                              'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
221
222     COMMON_SRC = bld.SUBDIR('common',
223                             '''ldb_modules.c ldb_ldif.c ldb_parse.c ldb_msg.c ldb_utf8.c
224                             ldb_debug.c ldb_dn.c ldb_match.c ldb_options.c ldb_pack.c
225                             ldb_attributes.c attrib_handlers.c ldb_controls.c qsort.c''')
226
227     bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
228                      init_function='ldb_ldap_init',
229                      module_init_name='ldb_init_module',
230                      deps='talloc lber ldap ldb',
231                      enabled=bld.env.ENABLE_LDAP_BACKEND,
232                      internal_module=False,
233                      subsystem='ldb')
234
235     if bld.PYTHON_BUILD_IS_ENABLED():
236         if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'):
237             for env in bld.gen_python_environments(['PKGCONFIGDIR']):
238
239                 name = bld.pyembed_libname('pyldb-util')
240                 bld.SAMBA_LIBRARY(name,
241                                   deps='replace ldb',
242                                   source='pyldb_util.c',
243                                   public_headers=('' if private_library else 'pyldb.h'),
244                                   public_headers_install=not private_library,
245                                   vnum=VERSION,
246                                   private_library=private_library,
247                                   pc_files='pyldb-util.pc',
248                                   pyembed=True,
249                                   enabled=bld.PYTHON_BUILD_IS_ENABLED(),
250                                   abi_directory='ABI',
251                                   abi_match='pyldb_*')
252
253                 if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
254                     bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
255                                      deps='replace ldb ' + name,
256                                      realname='ldb.so',
257                                      cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
258
259         # Do only install this file as part of the Samba build if we do not
260         # use the system libldb!
261         if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'):
262             for env in bld.gen_python_environments(['PKGCONFIGDIR']):
263                     bld.SAMBA_SCRIPT('_ldb_text.py',
264                                      pattern='_ldb_text.py',
265                                      installdir='python')
266
267                     bld.INSTALL_FILES('${PYTHONARCHDIR}', '_ldb_text.py')
268
269     if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
270         if bld.is_install:
271             modules_dir = bld.EXPAND_VARIABLES('${LDB_MODULESDIR}')
272         else:
273             # when we run from the source directory, we want to use
274             # the current modules, not the installed ones
275             modules_dir = os.path.join(os.getcwd(), 'bin/modules/ldb')
276
277         abi_match = '!ldb_*module_ops !ldb_*backend_ops ldb_*'
278
279         ldb_headers = ('include/ldb.h include/ldb_errors.h '
280                        'include/ldb_module.h include/ldb_handlers.h')
281
282         bld.SAMBA_LIBRARY('ldb',
283                           COMMON_SRC + ' ' + LDB_MAP_SRC,
284                           deps='tevent LIBLDB_MAIN replace',
285                           includes='include',
286                           public_headers=('' if private_library else ldb_headers),
287                           public_headers_install=not private_library,
288                           pc_files='ldb.pc',
289                           vnum=VERSION,
290                           private_library=private_library,
291                           manpages='man/ldb.3',
292                           abi_directory='ABI',
293                           abi_match = abi_match)
294
295         # generate a include/ldb_version.h
296         def generate_ldb_version_h(t):
297             '''generate a vscript file for our public libraries'''
298
299             tgt = t.outputs[0].bldpath(t.env)
300
301             v = t.env.LDB_VERSION.split('.')
302
303             f = open(tgt, mode='w')
304             try:
305                 f.write('#define LDB_VERSION "%s"\n' % t.env.LDB_VERSION)
306                 f.write('#define LDB_VERSION_MAJOR %d\n' % int(v[0]))
307                 f.write('#define LDB_VERSION_MINOR %d\n' % int(v[1]))
308                 f.write('#define LDB_VERSION_RELEASE %d\n' % int(v[2]))
309             finally:
310                 f.close()
311             return
312         t = bld.SAMBA_GENERATOR('ldb_version.h',
313                                 rule=generate_ldb_version_h,
314                                 dep_vars=['LDB_VERSION'],
315                                 target='include/ldb_version.h',
316                                 public_headers='include/ldb_version.h',
317                                 public_headers_install=not private_library)
318         t.env.LDB_VERSION = VERSION
319
320         bld.SAMBA_MODULE('ldb_asq',
321                          'modules/asq.c',
322                          init_function='ldb_asq_init',
323                          module_init_name='ldb_init_module',
324                          internal_module=False,
325                          deps='ldb',
326                          subsystem='ldb')
327
328         bld.SAMBA_MODULE('ldb_server_sort',
329                          'modules/sort.c',
330                          init_function='ldb_server_sort_init',
331                          internal_module=False,
332                          module_init_name='ldb_init_module',
333                          deps='ldb',
334                          subsystem='ldb')
335
336         bld.SAMBA_MODULE('ldb_paged_searches',
337                          'modules/paged_searches.c',
338                          init_function='ldb_paged_searches_init',
339                          internal_module=False,
340                          module_init_name='ldb_init_module',
341                          deps='ldb',
342                          subsystem='ldb')
343
344         bld.SAMBA_MODULE('ldb_rdn_name',
345                          'modules/rdn_name.c',
346                          init_function='ldb_rdn_name_init',
347                          internal_module=False,
348                          module_init_name='ldb_init_module',
349                          deps='ldb',
350                          subsystem='ldb')
351
352         bld.SAMBA_MODULE('ldb_sample',
353                          'tests/sample_module.c',
354                          init_function='ldb_sample_init',
355                          internal_module=False,
356                          module_init_name='ldb_init_module',
357                          deps='ldb',
358                          subsystem='ldb')
359
360         bld.SAMBA_MODULE('ldb_skel',
361                          'modules/skel.c',
362                          init_function='ldb_skel_init',
363                          internal_module=False,
364                          module_init_name='ldb_init_module',
365                          deps='ldb',
366                          subsystem='ldb')
367
368         bld.SAMBA_MODULE('ldb_sqlite3',
369                          'sqlite3/ldb_sqlite3.c',
370                          init_function='ldb_sqlite3_init',
371                          internal_module=False,
372                          module_init_name='ldb_init_module',
373                          enabled=False,
374                          deps='ldb',
375                          subsystem='ldb')
376
377         bld.SAMBA_MODULE('ldb_tdb',
378                          bld.SUBDIR('ldb_tdb',
379                                     '''ldb_tdb_init.c'''),
380                          init_function='ldb_tdb_init',
381                          module_init_name='ldb_init_module',
382                          internal_module=False,
383                          deps='ldb ldb_tdb_int ldb_key_value',
384                          subsystem='ldb')
385
386         bld.SAMBA_LIBRARY('ldb_tdb_int',
387                           bld.SUBDIR('ldb_tdb',
388                                      '''ldb_tdb_wrap.c ldb_tdb.c'''),
389                           private_library=True,
390                           deps='ldb tdb ldb_key_value ldb_tdb_err_map')
391
392         bld.SAMBA_LIBRARY('ldb_tdb_err_map',
393                           bld.SUBDIR('ldb_tdb',
394                                      '''ldb_tdb_err_map.c '''),
395                           private_library=True,
396                           deps='ldb tdb')
397
398         bld.SAMBA_LIBRARY('ldb_key_value',
399                           bld.SUBDIR('ldb_key_value',
400                                     '''ldb_kv.c ldb_kv_search.c ldb_kv_index.c
401                                     ldb_kv_cache.c'''),
402                           private_library=True,
403                           deps='tdb ldb ldb_tdb_err_map')
404
405         if bld.CONFIG_SET('HAVE_LMDB'):
406             bld.SAMBA_MODULE('ldb_mdb',
407                              bld.SUBDIR('ldb_mdb',
408                                         '''ldb_mdb_init.c'''),
409                              init_function='ldb_mdb_init',
410                              module_init_name='ldb_init_module',
411                              internal_module=False,
412                              deps='ldb ldb_key_value ldb_mdb_int',
413                              subsystem='ldb')
414
415             bld.SAMBA_LIBRARY('ldb_mdb_int',
416                               bld.SUBDIR('ldb_mdb',
417                                          '''ldb_mdb.c '''),
418                               private_library=True,
419                               deps='ldb lmdb ldb_key_value')
420             lmdb_deps = ' ldb_mdb_int'
421         else:
422             lmdb_deps = ''
423
424
425         bld.SAMBA_MODULE('ldb_ldb',
426                          bld.SUBDIR('ldb_ldb',
427                                     '''ldb_ldb.c'''),
428                          init_function='ldb_ldb_init',
429                          module_init_name='ldb_init_module',
430                          internal_module=False,
431                          deps='ldb ldb_tdb_int ldb_key_value' + lmdb_deps,
432                          subsystem='ldb')
433
434         # have a separate subsystem for common/ldb.c, so it can rebuild
435         # for install with a different -DLDB_MODULESDIR=
436         bld.SAMBA_SUBSYSTEM('LIBLDB_MAIN',
437                             'common/ldb.c',
438                             deps='tevent tdb',
439                             includes='include',
440                             cflags=['-DLDB_MODULESDIR=\"%s\"' % modules_dir])
441
442         LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
443         for t in LDB_TOOLS.split():
444             bld.SAMBA_BINARY(t, 'tools/%s.c' % t, deps='ldb-cmdline ldb',
445                              manpages='man/%s.1' % t)
446
447         # ldbtest doesn't get installed
448         bld.SAMBA_BINARY('ldbtest', 'tools/ldbtest.c', deps='ldb-cmdline ldb',
449                          install=False)
450
451         if bld.CONFIG_SET('HAVE_LMDB'):
452             lmdb_deps = ' lmdb'
453         else:
454             lmdb_deps = ''
455         # ldbdump doesn't get installed
456         bld.SAMBA_BINARY('ldbdump',
457                          'tools/ldbdump.c',
458                          deps='ldb-cmdline ldb' + lmdb_deps,
459                          install=False)
460
461         bld.SAMBA_LIBRARY('ldb-cmdline',
462                           source='tools/ldbutil.c tools/cmdline.c',
463                           deps='ldb dl popt',
464                           private_library=True)
465
466         bld.SAMBA_BINARY('ldb_tdb_mod_op_test',
467                          source='tests/ldb_mod_op_test.c',
468                          cflags='-DTEST_BE=\"tdb\"',
469                          deps='cmocka ldb',
470                          install=False)
471
472         bld.SAMBA_BINARY('ldb_tdb_guid_mod_op_test',
473                          source='tests/ldb_mod_op_test.c',
474                          cflags='-DTEST_BE=\"tdb\" -DGUID_IDX=1',
475                          deps='cmocka ldb',
476                          install=False)
477
478         bld.SAMBA_BINARY('ldb_tdb_kv_ops_test',
479                          source='tests/ldb_kv_ops_test.c',
480                          cflags='-DTEST_BE=\"tdb\"',
481                          deps='cmocka ldb',
482                          install=False)
483
484         bld.SAMBA_BINARY('ldb_tdb_test',
485                          source='tests/ldb_tdb_test.c',
486                          deps='cmocka ldb',
487                          install=False)
488
489         bld.SAMBA_BINARY('ldb_msg_test',
490                          source='tests/ldb_msg.c',
491                          deps='cmocka ldb',
492                          install=False)
493
494         bld.SAMBA_BINARY('test_ldb_qsort',
495                          source='tests/test_ldb_qsort.c',
496                          deps='cmocka ldb',
497                          install=False)
498
499         bld.SAMBA_BINARY('test_ldb_dn',
500                          source='tests/test_ldb_dn.c',
501                          deps='cmocka ldb',
502                          install=False)
503
504         bld.SAMBA_BINARY('ldb_match_test',
505                          source='tests/ldb_match_test.c',
506                          deps='cmocka ldb',
507                          install=False)
508
509         if bld.CONFIG_SET('HAVE_LMDB'):
510             bld.SAMBA_BINARY('ldb_mdb_mod_op_test',
511                              source='tests/ldb_mod_op_test.c',
512                              cflags='-DTEST_BE=\"mdb\" -DGUID_IDX=1 '
513                                   + '-DTEST_LMDB=1',
514                              deps='cmocka ldb lmdb',
515                              install=False)
516
517             bld.SAMBA_BINARY('ldb_lmdb_test',
518                              source='tests/ldb_lmdb_test.c',
519                              deps='cmocka ldb',
520                              install=False)
521
522             bld.SAMBA_BINARY('ldb_lmdb_size_test',
523                              source='tests/ldb_lmdb_size_test.c',
524                              deps='cmocka ldb',
525                              install=False)
526
527             bld.SAMBA_BINARY('ldb_mdb_kv_ops_test',
528                              source='tests/ldb_kv_ops_test.c',
529                              cflags='-DTEST_BE=\"mdb\"',
530                              deps='cmocka ldb',
531                              install=False)
532         else:
533             bld.SAMBA_BINARY('ldb_no_lmdb_test',
534                              source='tests/ldb_no_lmdb_test.c',
535                              deps='cmocka ldb',
536                              install=False)
537
538 def test(ctx):
539     '''run ldb testsuite'''
540     env = samba_utils.LOAD_ENVIRONMENT()
541     ctx.env = env
542
543     test_prefix = "%s/st" % (Context.g_module.out)
544     shutil.rmtree(test_prefix, ignore_errors=True)
545     os.makedirs(test_prefix)
546     os.environ['TEST_DATA_PREFIX'] = test_prefix
547     os.environ['LDB_MODULES_PATH'] = Context.g_module.out + "/modules/ldb"
548     if env.HAVE_LMDB:
549         os.environ['HAVE_LMDB'] = '1'
550     else:
551         os.environ['HAVE_LMDB'] = '0'
552     samba_utils.ADD_LD_LIBRARY_PATH('bin/shared')
553     samba_utils.ADD_LD_LIBRARY_PATH('bin/shared/private')
554
555     cmd = 'tests/test-tdb.sh %s' % Context.g_module.out
556     ret = samba_utils.RUN_COMMAND(cmd)
557     print("testsuite returned %d" % ret)
558
559     tmp_dir = os.path.join(test_prefix, 'tmp')
560     if not os.path.exists(tmp_dir):
561         os.mkdir(tmp_dir)
562     pyret = samba_utils.RUN_PYTHON_TESTS(
563         ['tests/python/api.py', 'tests/python/index.py'],
564         extra_env={'SELFTEST_PREFIX': test_prefix})
565     print("Python testsuite returned %d" % pyret)
566
567     cmocka_ret = 0
568     test_exes = ['test_ldb_qsort',
569                  'test_ldb_dn',
570                  'ldb_msg_test',
571                  'ldb_tdb_mod_op_test',
572                  'ldb_tdb_guid_mod_op_test',
573                  'ldb_msg_test',
574                  'ldb_tdb_kv_ops_test',
575                  'ldb_tdb_test',
576                  'ldb_match_test']
577
578     if env.HAVE_LMDB:
579         test_exes += ['ldb_mdb_mod_op_test',
580                      'ldb_lmdb_test',
581                      # we don't want to run ldb_lmdb_size_test (which proves we can
582                      # fit > 4G of data into the DB), it would fill up the disk on
583                      # many of our test instances
584                      'ldb_mdb_kv_ops_test']
585     else:
586         test_exes += ['ldb_no_lmdb_test']
587
588     for test_exe in test_exes:
589             cmd = os.path.join(Context.g_module.out, test_exe)
590             cmocka_ret = cmocka_ret or samba_utils.RUN_COMMAND(cmd)
591
592     sys.exit(ret or pyret or cmocka_ret)
593
594 def dist():
595     '''makes a tarball for distribution'''
596     samba_dist.dist()
597
598 def reconfigure(ctx):
599     '''reconfigure if config scripts have changed'''
600     import samba_utils
601     samba_utils.reconfigure(ctx)