The branch, master has been updated via 31019d3 python: tests: Add test for tdb_copy function from tdb_util module. via d5d6d20 ldb: Use libraries from build dir for testsuite via 9e1cbce talloc: Fix execution of test_magic_differs from tarball via 4ad5849 talloc: Use libraries from build dir for testsuite from e317dfe WHATSNEW: Start release notes for Samba 4.8.0pre1.
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 31019d338d2d4b3c17b7f25d863e6d85f29c3cec Author: Lumir Balhar <lbal...@redhat.com> Date: Tue Jul 4 11:39:28 2017 +0200 python: tests: Add test for tdb_copy function from tdb_util module. Signed-off-by: Lumir Balhar <lbal...@redhat.com> Reviewed-by: Alexander Bokovoy <a...@samba.org> Reviewed-by: Andrew Bartlet <abart...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> Autobuild-User(master): Andreas Schneider <a...@cryptomilk.org> Autobuild-Date(master): Wed Jul 5 02:00:25 CEST 2017 on sn-devel-144 commit d5d6d209dedd60f8e99d11789f2a0d4e2bf95896 Author: Lukas Slebodnik <lsleb...@redhat.com> Date: Tue Jul 4 00:32:31 2017 +0200 ldb: Use libraries from build dir for testsuite There was a failure when tests were executed after after extracting ldb tarball. sh$ make -j8 check WAF_MAKE=1 PATH=buildtools/bin:../../buildtools/bin:$PATH waf test ldbadd: error while loading shared libraries: libldb.so.1: cannot open shared object file: No such file or directory cat: write error: Broken pipe Traceback (most recent call last): File "tests/python/api.py", line 10, in <module> import ldb ImportError: libldb.so.1: cannot open shared object file: No such file or directory Traceback (most recent call last): File "tests/python/api.py", line 10, in <module> import ldb ImportError: libpyldb-util.so.1: cannot open shared object file: No such file or directory bin/ldb_tdb_mod_op_test: error while loading shared libraries: libldb.so.1: cannot open shared object file: No such file or directory testsuite returned 1 Signed-off-by: Lukas Slebodnik <lsleb...@redhat.com> Reviewed-by: Andreas Schneider <a...@samba.org> Signed-off-by: Alexander Bokovoy <a...@samba.org> commit 9e1cbce2731f0d862966854113640970f710e572 Author: Lukas Slebodnik <lsleb...@redhat.com> Date: Mon Jul 3 16:17:44 2017 +0200 talloc: Fix execution of test_magic_differs from tarball make check failed in case of tarball because test_magic_differs.sh is in top level directory and not in sub-directory lib/talloc sh: ./lib/talloc/test_magic_differs.sh: No such file or directory magic differs test returned 127 Signed-off-by: Lukas Slebodnik <lsleb...@redhat.com> Reviewed-by: Andrew Bartlet <abart...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> commit 4ad58497e5baa50b25eaeeff1386fc154dfc5399 Author: Lukas Slebodnik <lsleb...@redhat.com> Date: Mon Jul 3 16:09:34 2017 +0200 talloc: Use libraries from build dir for testsuite There was a failure when tests were executed after after extracting talloc tarball. sh$ make -j8 check WAF_MAKE=1 PATH=buildtools/bin:../../buildtools/bin:$PATH waf test bin/talloc_testsuite: error while loading shared libraries: libtalloc.so.2: cannot open shared object file: No such file or directory sh: ./lib/talloc/test_magic_differs.sh: No such file or directory Traceback (most recent call last): File "test_pytalloc.py", line 11, in <module> import talloc ImportError: libtalloc.so.2: cannot open shared object file: No such file or directory Signed-off-by: Lukas Slebodnik <lsleb...@redhat.com> Reviewed-by: Andrew Bartlet <abart...@samba.org> Reviewed-by: Andreas Schneider <a...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/ldb/wscript | 7 +++--- lib/talloc/wscript | 6 +++++ python/samba/tests/tdb_util.py | 53 ++++++++++++++++++++++++++++++++++++++++++ selftest/tests.py | 1 + 4 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 python/samba/tests/tdb_util.py Changeset truncated at 500 lines: diff --git a/lib/ldb/wscript b/lib/ldb/wscript index 6f36965..7f81fe3 100644 --- a/lib/ldb/wscript +++ b/lib/ldb/wscript @@ -358,7 +358,10 @@ def test(ctx): shutil.rmtree(test_prefix, ignore_errors=True) os.makedirs(test_prefix) os.environ['TEST_DATA_PREFIX'] = test_prefix - os.environ['LD_LIBRARY_PATH'] = Utils.g_module.blddir + '/bin/default/lib/ldb' + os.environ['LDB_MODULES_PATH'] = Utils.g_module.blddir + "/modules/ldb" + samba_utils.ADD_LD_LIBRARY_PATH('bin/shared') + samba_utils.ADD_LD_LIBRARY_PATH('bin/shared/private') + cmd = 'tests/test-tdb.sh %s' % Utils.g_module.blddir ret = samba_utils.RUN_COMMAND(cmd) print("testsuite returned %d" % ret) @@ -371,8 +374,6 @@ def test(ctx): extra_env={'SELFTEST_PREFIX': test_prefix}) print("Python testsuite returned %d" % pyret) - os.environ['LDB_MODULES_PATH'] = Utils.g_module.blddir + '/modules/ldb' - os.environ['LD_LIBRARY_PATH'] = Utils.g_module.blddir + '/bin/default/lib/ldb' cmocka_ret = 0 for test_exe in ['ldb_tdb_mod_op_test', 'ldb_msg_test']: diff --git a/lib/talloc/wscript b/lib/talloc/wscript index df7e6be..09f780b 100644 --- a/lib/talloc/wscript +++ b/lib/talloc/wscript @@ -171,12 +171,18 @@ def build(bld): def test(ctx): '''run talloc testsuite''' import Utils, samba_utils + + samba_utils.ADD_LD_LIBRARY_PATH('bin/shared') + samba_utils.ADD_LD_LIBRARY_PATH('bin/shared/private') + cmd = os.path.join(Utils.g_module.blddir, 'talloc_testsuite') ret = samba_utils.RUN_COMMAND(cmd) print("testsuite returned %d" % ret) magic_helper_cmd = os.path.join(Utils.g_module.blddir, 'talloc_test_magic_differs_helper') magic_cmd = os.path.join(srcdir, 'lib', 'talloc', 'test_magic_differs.sh') + if not os.path.exists(magic_cmd): + magic_cmd = os.path.join(srcdir, 'test_magic_differs.sh') magic_ret = samba_utils.RUN_COMMAND(magic_cmd + " " + magic_helper_cmd) print("magic differs test returned %d" % magic_ret) diff --git a/python/samba/tests/tdb_util.py b/python/samba/tests/tdb_util.py new file mode 100644 index 0000000..93c83a8 --- /dev/null +++ b/python/samba/tests/tdb_util.py @@ -0,0 +1,53 @@ +# Unix SMB/CIFS implementation. +# Copyright (C) Lumir Balhar <lbal...@redhat.com> 2017 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +import samba.tests +from samba import ldb, Ldb +from samba.tdb_util import tdb_copy +import os + + +class TDBUtilTests(samba.tests.TestCaseInTempDir): + + def setUp(self): + super(TDBUtilTests, self).setUp() + + def test_tdb_copy(self): + src_ldb_file = os.path.join(self.tempdir, "source.ldb") + dst_ldb_file = os.path.join(self.tempdir, "destination.ldb") + + # Create LDB source file with some content + src_ldb = Ldb(src_ldb_file) + src_ldb.add({"dn": "f=dc", "b": "bla"}) + + # Copy source file to destination file and check return status + self.assertIsNone(tdb_copy(src_ldb_file, dst_ldb_file)) + + # Load copied file as LDB object + dst_ldb = Ldb(dst_ldb_file) + + # Copmare contents of files + self.assertEqual( + src_ldb.searchone(basedn=ldb.Dn(src_ldb, "f=dc"), attribute="b"), + dst_ldb.searchone(basedn=ldb.Dn(dst_ldb, "f=dc"), attribute="b") + ) + + # Clean up + del src_ldb + del dst_ldb + os.unlink(src_ldb_file) + os.unlink(dst_ldb_file) diff --git a/selftest/tests.py b/selftest/tests.py index 175b56c..40ae20b 100644 --- a/selftest/tests.py +++ b/selftest/tests.py @@ -137,6 +137,7 @@ plantestsuite( [os.path.join(srcdir(), "script/tests/test_traffic_summary.sh"), configuration]) planpythontestsuite("none", "samba.tests.glue", py3_compatible=True) +planpythontestsuite("none", "samba.tests.tdb_util", py3_compatible=True) if with_pam: plantestsuite("samba.tests.pam_winbind(local)", "ad_member", -- Samba Shared Repository