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