ldb: Move tests to selftest/tests.py and out of standlone build
authorAndrew Bartlett <abartlet@samba.org>
Sun, 4 Feb 2024 23:34:42 +0000 (12:34 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 1 Mar 2024 02:41:36 +0000 (02:41 +0000)
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 <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
lib/ldb/wscript
selftest/slow-none
selftest/tests.py

index 67cc576d39eac03ef7bf1b5046655862fd466052..91bcb9ef06139024e4694756d479aa0c77f9e481 100644 (file)
@@ -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'''
index 34b2608481a5fd83a414b491b0e3c051a3fffd57..9d905c3348498889435ab005b32736be70605839 100644 (file)
@@ -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
index e4acc30edcc48b7070a6bad0c70dc0ad570426f0..48dddadf561fda6b07c4522febf0fb6368051f83 100644 (file)
@@ -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")