summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2015-06-08 14:17:12 +0200
committerStefan Metzmacher <metze@samba.org>2015-11-05 18:04:23 +0100
commitc54fc3f2b6479a5c48d801626fb01f68da6894c7 (patch)
tree3569d769e0a7c434c350192c7bc2d741b0ebb715
parent9884a8fa58ffc8ddff0977c069aedda3beb6415f (diff)
downloadsamba-c54fc3f2b6479a5c48d801626fb01f68da6894c7.tar.gz
ldb: Run the Python testsuite
Signed-off-by: Petr Viktorin <pviktori@redhat.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--buildtools/wafsamba/samba_utils.py5
-rwxr-xr-xlib/ldb/tests/test-tdb.sh7
-rwxr-xr-xlib/ldb/wscript11
3 files changed, 13 insertions, 10 deletions
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 36d3929f549..fb1355c768e 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -385,7 +385,7 @@ def RUN_COMMAND(cmd,
return -1
-def RUN_PYTHON_TESTS(testfiles, pythonpath=None):
+def RUN_PYTHON_TESTS(testfiles, pythonpath=None, extra_env=None):
env = LOAD_ENVIRONMENT()
if pythonpath is None:
pythonpath = os.path.join(Utils.g_module.blddir, 'python')
@@ -393,6 +393,9 @@ def RUN_PYTHON_TESTS(testfiles, pythonpath=None):
for interp in env.python_interpreters:
for testfile in testfiles:
cmd = "PYTHONPATH=%s %s %s" % (pythonpath, interp, testfile)
+ if extra_env:
+ for key, value in extra_env.items():
+ cmd = "%s=%s %s" % (key, value, cmd)
print('Running Python test with %s: %s' % (interp, testfile))
ret = RUN_COMMAND(cmd)
if ret:
diff --git a/lib/ldb/tests/test-tdb.sh b/lib/ldb/tests/test-tdb.sh
index 82eef69df81..91c48abe145 100755
--- a/lib/ldb/tests/test-tdb.sh
+++ b/lib/ldb/tests/test-tdb.sh
@@ -7,9 +7,7 @@ if [ -n "$TEST_DATA_PREFIX" ]; then
PYDESTDIR="$TEST_DATA_PREFIX"
else
LDB_URL="tdbtest.ldb"
- PYDESTDIR="/tmp"
fi
-mkdir $PYDESTDIR/tmp
export LDB_URL
PATH=$BINDIR:$PATH
@@ -38,8 +36,3 @@ $VALGRIND ldbadd $LDBDIR/tests/init.ldif || exit 1
. $LDBDIR/tests/test-tdb-features.sh
. $LDBDIR/tests/test-controls.sh
-
-which python >/dev/null 2>&1
-if [ $? -eq 0 ]; then
- SELFTEST_PREFIX=$PYDESTDIR PYTHONPATH=$BINDIR/python python $LDBDIR/tests/python/api.py
-fi
diff --git a/lib/ldb/wscript b/lib/ldb/wscript
index 70b84cbe065..8322a56997b 100755
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -284,8 +284,15 @@ def test(ctx):
cmd = 'tests/test-tdb.sh %s' % Utils.g_module.blddir
ret = samba_utils.RUN_COMMAND(cmd)
print("testsuite returned %d" % ret)
- # FIXME: Run python testsuite
- sys.exit(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'],
+ extra_env={'SELFTEST_PREFIX': test_prefix})
+ print("Python testsuite returned %d" % pyret)
+ sys.exit(ret or pyret)
def dist():
'''makes a tarball for distribution'''