From: Andrew Bartlett Date: Sun, 4 Feb 2024 23:34:42 +0000 (+1300) Subject: ldb: Move tests to selftest/tests.py and out of standlone build X-Git-Tag: tdb-1.4.11~1620 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8af7867505ee7dc61914cbce4e534d3f71f838ab;p=thirdparty%2Fsamba.git ldb: Move tests to selftest/tests.py and out of standlone build Tests that are declared in the tests.py files in the main Samba build are able to use the common knownfail, flapping and skip systems. This will also allow the independent ldb build to be removed without loss of the tests. Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/lib/ldb/wscript b/lib/ldb/wscript index 67cc576d39e..91bcb9ef061 100644 --- a/lib/ldb/wscript +++ b/lib/ldb/wscript @@ -603,10 +603,6 @@ def test(ctx): os.makedirs(test_prefix) os.environ['TEST_DATA_PREFIX'] = test_prefix os.environ['LDB_MODULES_PATH'] = Context.g_module.out + "/modules/ldb" - if env.HAVE_LMDB: - os.environ['HAVE_LMDB'] = '1' - else: - os.environ['HAVE_LMDB'] = '0' samba_utils.ADD_LD_LIBRARY_PATH('bin/shared') samba_utils.ADD_LD_LIBRARY_PATH('bin/shared/private') @@ -614,24 +610,6 @@ def test(ctx): ret = samba_utils.RUN_COMMAND(cmd) print("testsuite returned %d" % ret) - tmp_dir = os.path.join(test_prefix, 'tmp') - if not os.path.exists(tmp_dir): - os.mkdir(tmp_dir) - pyret = samba_utils.RUN_PYTHON_TESTS( - ['tests/python/api.py', - 'tests/python/crash.py', - 'tests/python/index.py', - 'tests/python/repack.py'], - extra_env={'SELFTEST_PREFIX': test_prefix}) - pyret = samba_utils.RUN_PYTHON_TESTS( - ['tests/python/api.py', - 'tests/python/crash.py', - 'tests/python/index.py', - 'tests/python/repack.py'], - extra_env={'SELFTEST_PREFIX': test_prefix, - 'LC_ALL': 'tr_TR.UTF-8'}) or pyret - print("Python testsuite returned %d" % pyret) - cmocka_ret = 0 test_exes = ['test_ldb_qsort', 'test_ldb_dn', @@ -673,7 +651,7 @@ def test(ctx): cmd = os.path.join(Context.g_module.out, test_exe) cmocka_ret = cmocka_ret or samba_utils.RUN_COMMAND(cmd) - sys.exit(ret or pyret or cmocka_ret) + sys.exit(ret or cmocka_ret) def dist(): '''makes a tarball for distribution''' diff --git a/selftest/slow-none b/selftest/slow-none index 34b2608481a..9d905c33484 100644 --- a/selftest/slow-none +++ b/selftest/slow-none @@ -2,7 +2,7 @@ # tests are running, to avoid really slow tests being run on multiple # hosts that host the samba-o3 job. ^samba.tests.docs -^ldb.python +^ldb.python.api ^samba.tests.dsdb_lock ^samba4.blackbox.upgradeprovision.alpha13 ^samba4.blackbox.upgradeprovision.release-4-0-0 diff --git a/selftest/tests.py b/selftest/tests.py index e4acc30edcc..48dddadf561 100644 --- a/selftest/tests.py +++ b/selftest/tests.py @@ -49,6 +49,7 @@ pam_wrapper_so_path = config_hash.get("LIBPAM_WRAPPER_SO_PATH") pam_set_items_so_path = config_hash.get("PAM_SET_ITEMS_SO_PATH") have_heimdal_support = "SAMBA4_USES_HEIMDAL" in config_hash using_system_gssapi = "USING_SYSTEM_GSSAPI" in config_hash +have_lmdb = "HAVE_LMDB" in config_hash planpythontestsuite("none", "samba.tests.source") planpythontestsuite("none", "samba.tests.source_chars") @@ -64,7 +65,45 @@ else: planpythontestsuite("none", "subunit.tests.test_suite") planpythontestsuite("none", "samba.tests.blackbox.ndrdump") planpythontestsuite("none", "samba.tests.blackbox.check_output") -planpythontestsuite("none", "api", name="ldb.python", extra_path=['lib/ldb/tests/python']) + +# LDB tests for standalone operation +planpythontestsuite("none", "api", + name="ldb.python.api", + extra_path=['lib/ldb/tests/python'], + environ={'HAVE_LMDB': str(int(have_lmdb))}) +planpythontestsuite("none", "crash", + name="ldb.python.crash", + extra_path=['lib/ldb/tests/python'], + environ={'HAVE_LMDB': str(int(have_lmdb))}) +planpythontestsuite("none", "index", + name="ldb.python.index", + extra_path=['lib/ldb/tests/python'], + environ={'HAVE_LMDB': str(int(have_lmdb))}) +planpythontestsuite("none", "repack", + name="ldb.python.repack", + extra_path=['lib/ldb/tests/python'], + environ={'HAVE_LMDB': str(int(have_lmdb))}) + +# LDB tests for standalone operation, in the tr_TR.UTF-8 to cover +# dotless i locales, see +# https://bugzilla.samba.org/show_bug.cgi?id=15248 +planpythontestsuite("none", "api", + name="ldb.python.api.tr", + extra_path=['lib/ldb/tests/python'], + environ={'LC_ALL': 'tr_TR.UTF-8'}) +planpythontestsuite("none", "crash", + name="ldb.python.crash.tr", + extra_path=['lib/ldb/tests/python'], + environ={'LC_ALL': 'tr_TR.UTF-8'}) +planpythontestsuite("none", "index", + name="ldb.python.index.tr", + extra_path=['lib/ldb/tests/python'], + environ={'LC_ALL': 'tr_TR.UTF-8'}) +planpythontestsuite("none", "repack", + name="ldb.python.repack.tr", + extra_path=['lib/ldb/tests/python'], + environ={'LC_ALL': 'tr_TR.UTF-8'}) + planpythontestsuite("none", "samba.tests.credentials") planpythontestsuite("none", "samba.tests.registry") planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.auth")