[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Fri Dec 23 15:32:01 UTC 2022


The branch, master has been updated
       via  08be04bb930 s4:setup:tests: Use system ldbdump if we build with system ldb
       via  6b4cc4ccbca python:tests: Use system ldbsearch if we built against system libldb
       via  9ac8dac6dbb python:tests: Use system ldbdump if we build with system ldb
       via  11be7d802d3 python:tests: Use system ldbsearch if we build with system libldb
       via  5bed51fc6f0 nsswitch:tests: Use system_or_builddir_binary() for test_rfc2307_mapping
       via  eb6f74bd74f testprogs: Use system_or_builddir_binary() for upgradeprovision-oldrelease
       via  40eeec0fff8 testprogs: Use system_or_builddir_binary() for tombstones-expunge
       via  39468deb738 testprogs: Use system_or_builddir_binary() for test_trust_token
       via  1106ef7189e testprogs: Use system_or_builddir_binary() for test_special_group
       via  7c46c79a222 testprogs: Use system_or_builddir_binary() for test_primary_group
       via  605155f296c testprogs: Use system_or_builddir_binary() for test_pkinit_simple
       via  56b9723816f testprogs: Use system_or_builddir_binary() for test_pkinit_pac
       via  c6cd1263275 testprogs: Use system_or_builddir_binary() for test_old_enctypes
       via  535bc5dca7f testprogs: Use system_or_builddir_binary() for test_net_ads_dns
       via  376ca5a108f testprogs: Use system_or_builddir_binary() for test_net_ads
       via  d891e59088a testprogs: Use system_or_builddir_binary() for test_ldb_simple
       via  c11f1912c95 testprogs: Use system_or_builddir_binary() for test_ldb
       via  7baa3e13f26 testprogs: Use system_or_builddir_binary() for test_ktpass
       via  fa5cba8f6ff testprogs: Use system_or_builddir_binary() for test_kinit_mit
       via  c9ca0f796cd testprogs: Use system_or_builddir_binary() for test_kinit_heimdal
       via  6b7e5059635 testprogs: Use system_or_builddir_binary() for test_client_kerberos
       via  68471100045 testprogs: Use system_or_builddir_binary() for renamedc
       via  e6ab157f82c testprogs: Use system_or_builddir_binary() for ldapcmp_restoredc
       via  2cfe2664392 testprogs: Use system_or_builddir_binary() for functionalprep
       via  4981cb45dbd testprogs: Use system_or_builddir_binary() for demote-saveddb
       via  ee11fafcc91 testprogs: Use system_or_builddir_binary() for dbcheck-oldrelease
       via  0aa24330c55 testprogs: Use system_or_builddir_binary() for dbcheck and runtime tests
       via  e5910d2895e testprogs: Add system_or_builddir_binary()
       via  9a32c8087a6 testprogs: Fix remove_directory()
      from  0c931fb301c waf: Run python tests also with tr_TR locale

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 08be04bb930f8cdb370ea3d3a31907ab475d8989
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 15:25:49 2022 +0100

    s4:setup:tests: Use system ldbdump if we build with system ldb
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Fri Dec 23 15:31:31 UTC 2022 on sn-devel-184

commit 6b4cc4ccbca5a02a339d15b8b3557b5d38d70910
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 15:29:56 2022 +0100

    python:tests: Use system ldbsearch if we built against system libldb
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 9ac8dac6dbbdb470f0fa0878c1fa1aeca172b73a
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 15:16:04 2022 +0100

    python:tests: Use system ldbdump if we build with system ldb
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 11be7d802d33d0376ec5c36ddd8d30d32b088a1e
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:47:25 2022 +0100

    python:tests: Use system ldbsearch if we build with system libldb
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 5bed51fc6f001f521ab15bd01f4e30b034b4437b
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 16:54:30 2022 +0100

    nsswitch:tests: Use system_or_builddir_binary() for test_rfc2307_mapping
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit eb6f74bd74f4157caf5dec751f43d23a52aedf77
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:43:45 2022 +0100

    testprogs: Use system_or_builddir_binary() for upgradeprovision-oldrelease
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 40eeec0fff8d06b3c5a6e3c92f3fa1a61802092c
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:42:12 2022 +0100

    testprogs: Use system_or_builddir_binary() for tombstones-expunge
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 39468deb738e9e8c0c7eff74a3cc6a254eaa9b00
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:37:21 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_trust_token
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 1106ef7189eeff49b47c295b5d5df179a3f8b672
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:36:29 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_special_group
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 7c46c79a222e22d120632cf3ded739871f66b28f
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:34:00 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_primary_group
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 605155f296c19485cfd770509d84f49ca6da43ed
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:32:59 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_pkinit_simple
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 56b9723816f5f9bd1adbe39a7c64265122bf49d4
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:31:54 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_pkinit_pac
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit c6cd1263275d5a48b98c2796e09f72909fb6455e
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:03:29 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_old_enctypes
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 535bc5dca7fdda0b00293f7670f320a6feb14247
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 14:02:04 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_net_ads_dns
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 376ca5a108f4e6e1e34166a7bd6047122f424744
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:45:17 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_net_ads
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit d891e59088a20b154f2077be6ed186ae3d17cd7e
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:38:27 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_ldb_simple
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit c11f1912c955a56d646526f409d0b42542cafa99
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:34:39 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_ldb
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 7baa3e13f262286a0cde4253975955c71b9496d0
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:24:21 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_ktpass
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit fa5cba8f6ff954bc19faebed2da2cdce5b337a3a
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:22:36 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_kinit_mit
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit c9ca0f796cd63aee1aa7e13d7de15ab9930b8133
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:21:18 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_kinit_heimdal
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 6b7e505963539f3d09c43ba9cb4d0dfe9e769187
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:19:27 2022 +0100

    testprogs: Use system_or_builddir_binary() for test_client_kerberos
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 6847110004564c2dace796013cca04d6defab836
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:10:34 2022 +0100

    testprogs: Use system_or_builddir_binary() for renamedc
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit e6ab157f82c0bf5e8e17f0c6280fdfcd60b15176
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:06:55 2022 +0100

    testprogs: Use system_or_builddir_binary() for ldapcmp_restoredc
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 2cfe2664392c6dc1d6505ef96f94621174fa04b2
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:05:05 2022 +0100

    testprogs: Use system_or_builddir_binary() for functionalprep
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 4981cb45dbdd6d0059b80f61091c8b97c36abbeb
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:04:25 2022 +0100

    testprogs: Use system_or_builddir_binary() for demote-saveddb
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit ee11fafcc91bcd24d94e81f449cd5c637ca95823
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:03:13 2022 +0100

    testprogs: Use system_or_builddir_binary() for dbcheck-oldrelease
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 0aa24330c55427f1feb0ce001a93808a23904e96
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 12:57:39 2022 +0100

    testprogs: Use system_or_builddir_binary() for dbcheck and runtime tests
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit e5910d2895ed6f7665f79876de433b861bfdb237
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 08:36:26 2022 +0100

    testprogs: Add system_or_builddir_binary()
    
    This should be used if we use a system or builddir binary.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 9a32c8087a6ecd2aaa46e3f7728c99f862f553a1
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Dec 22 13:13:54 2022 +0100

    testprogs: Fix remove_directory()
    
    common_test_fns.inc: line 121: [: too many arguments
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 nsswitch/tests/test_rfc2307_mapping.sh            |  9 ++----
 python/samba/tests/blackbox/bug13653.py           | 16 +++++++----
 python/samba/tests/blackbox/downgradedatabase.py  |  6 +++-
 python/samba/tests/samba_tool/computer_edit.sh    |  5 +++-
 source4/setup/tests/blackbox_start_backup.sh      |  5 +++-
 testprogs/blackbox/common-links.sh                | 35 ++++-------------------
 testprogs/blackbox/common_test_fns.inc            | 30 ++++++++++++++++++-
 testprogs/blackbox/dbcheck-links.sh               |  2 +-
 testprogs/blackbox/dbcheck-oldrelease.sh          | 25 ++++------------
 testprogs/blackbox/demote-saveddb.sh              |  5 +---
 testprogs/blackbox/functionalprep.sh              |  5 +---
 testprogs/blackbox/ldapcmp_restoredc.sh           |  6 ++--
 testprogs/blackbox/renamedc.sh                    |  9 ++----
 testprogs/blackbox/runtime-links.sh               |  2 +-
 testprogs/blackbox/test_client_kerberos.sh        | 11 ++-----
 testprogs/blackbox/test_kinit_heimdal.sh          | 13 ++-------
 testprogs/blackbox/test_kinit_mit.sh              | 14 +++------
 testprogs/blackbox/test_ktpass.sh                 |  5 +---
 testprogs/blackbox/test_ldb.sh                    |  5 ++--
 testprogs/blackbox/test_ldb_simple.sh             |  5 ++--
 testprogs/blackbox/test_net_ads.sh                | 26 ++++-------------
 testprogs/blackbox/test_net_ads_dns.sh            | 15 +++-------
 testprogs/blackbox/test_old_enctypes.sh           | 13 ++-------
 testprogs/blackbox/test_password_settings.sh      |  7 ++---
 testprogs/blackbox/test_pkinit_pac.sh             |  6 ++--
 testprogs/blackbox/test_pkinit_simple.sh          |  6 ++--
 testprogs/blackbox/test_primary_group.sh          | 11 ++-----
 testprogs/blackbox/test_special_group.sh          |  5 +---
 testprogs/blackbox/test_trust_token.sh            |  7 ++---
 testprogs/blackbox/tombstones-expunge.sh          | 28 +++---------------
 testprogs/blackbox/upgradeprovision-oldrelease.sh | 13 ++-------
 31 files changed, 121 insertions(+), 229 deletions(-)


Changeset truncated at 500 lines:

diff --git a/nsswitch/tests/test_rfc2307_mapping.sh b/nsswitch/tests/test_rfc2307_mapping.sh
index d6d39a10b68..66ee865f8eb 100755
--- a/nsswitch/tests/test_rfc2307_mapping.sh
+++ b/nsswitch/tests/test_rfc2307_mapping.sh
@@ -19,14 +19,11 @@ failed=0
 samba4bindir="$BINDIR"
 wbinfo="$VALGRIND $samba4bindir/wbinfo"
 samba_tool="$VALGRIND $samba4bindir/samba-tool"
-if [ -f "$samba4bindir/ldbmodify" ]; then
-	ldbmodify="$samba4bindir/ldbmodify"
-else
-	# Using system ldbmodify
-	ldbmodify="ldbmodify"
-fi
 
 . $(dirname $0)/../../testprogs/blackbox/subunit.sh
+. "$(dirname "${0}")/../../testprogs/blackbox/common_test_fns.inc"
+
+ldbmodify=$(system_or_builddir_binary ldbmodify "${BINDIR}")
 
 testfail()
 {
diff --git a/python/samba/tests/blackbox/bug13653.py b/python/samba/tests/blackbox/bug13653.py
index 6c6b9aece89..79b0af85ca1 100644
--- a/python/samba/tests/blackbox/bug13653.py
+++ b/python/samba/tests/blackbox/bug13653.py
@@ -120,7 +120,7 @@ from samba.tests import (
 from samba.credentials import Credentials
 from samba.samdb import SamDB
 from samba.auth import system_session
-from os import environ
+import os
 
 
 class Bug13653Tests(BlackboxTestCase):
@@ -129,9 +129,9 @@ class Bug13653Tests(BlackboxTestCase):
     # and load configuration from the OS environment.
     def setUp(self):
         super(Bug13653Tests, self).setUp()
-        self.env = environ["TEST_ENV"]
-        self.server = environ["SERVER"]
-        self.prefix = environ["PREFIX_ABS"]
+        self.env = os.environ["TEST_ENV"]
+        self.server = os.environ["SERVER"]
+        self.prefix = os.environ["PREFIX_ABS"]
         lp = env_loadparm()
         creds = Credentials()
         session = system_session()
@@ -178,9 +178,13 @@ class Bug13653Tests(BlackboxTestCase):
                 "samba-tool user create %s %s -H %s" % (
                     self.user, password, db_path)
             self.check_run(command)
+
+            ldbsearch = "ldbsearch"
+            if os.path.exists("bin/ldbsearch"):
+                ldbsearch = "bin/ldbsearch"
             command =\
-                "bin/ldbsearch -H ldap://%s/ -U%s%%%s '(cn=%s)' dn" % (
-                    self.server, self.user, password, self.user)
+                "%s -H ldap://%s/ -U%s%%%s '(cn=%s)' dn" % (
+                    ldbsearch, self.server, self.user, password, self.user)
             self.check_run(command)
         except BlackboxProcessError as e:
             self.fail(str(e))
diff --git a/python/samba/tests/blackbox/downgradedatabase.py b/python/samba/tests/blackbox/downgradedatabase.py
index 8d80ef6e804..e4d772be83e 100644
--- a/python/samba/tests/blackbox/downgradedatabase.py
+++ b/python/samba/tests/blackbox/downgradedatabase.py
@@ -71,8 +71,12 @@ class DowngradeTestBase(BlackboxTestCase):
     def ldbdump_keys_pack_formats(self):
         # Get all comments from all partition dbs
         comments = []
+        ldbdump = "ldbdump"
+        if os.path.exists("bin/ldbdump"):
+            ldbdump = "bin/ldbdump"
+
         for db in self.dbs:
-            dump = check_output(["bin/ldbdump", "-i", db])
+            dump = check_output([ldbdump, "-i", db])
             dump = dump.decode("utf-8")
             dump = dump.split("\n")
             comments += [s for s in dump if s.startswith("#")]
diff --git a/python/samba/tests/samba_tool/computer_edit.sh b/python/samba/tests/samba_tool/computer_edit.sh
index a52128c6589..500a00d9a34 100755
--- a/python/samba/tests/samba_tool/computer_edit.sh
+++ b/python/samba/tests/samba_tool/computer_edit.sh
@@ -15,6 +15,9 @@ PASSWORD="$3"
 
 STpath=$(pwd)
 . $STpath/testprogs/blackbox/subunit.sh
+. "${STpath}/testprogs/blackbox/common_test_fns.inc"
+
+ldbsearch=$(system_or_builddir_binary ldbsearch "${BINDIR}")
 
 display_name="Björns laptop"
 display_name_b64="QmrDtnJucyBsYXB0b3A="
@@ -70,7 +73,7 @@ EOF
 
 get_attribute_base64()
 {
-	${STpath}/bin/ldbsearch '(sAMAccountName=testmachine1$)' displayName \
+	${ldbsearch} '(sAMAccountName=testmachine1$)' displayName \
 		-H "ldap://$SERVER" "-U$USERNAME" "--password=$PASSWORD"
 }
 
diff --git a/source4/setup/tests/blackbox_start_backup.sh b/source4/setup/tests/blackbox_start_backup.sh
index 044b9c49a78..b380c38617f 100755
--- a/source4/setup/tests/blackbox_start_backup.sh
+++ b/source4/setup/tests/blackbox_start_backup.sh
@@ -17,6 +17,9 @@ DBPATH=$PREFIX/start-backup
 mkdir -p $DBPATH
 
 . $(dirname $0)/../../../testprogs/blackbox/subunit.sh
+. "$(dirname ${0})/../../../testprogs/blackbox/common_test_fns.inc"
+
+ldbmodify=$(system_or_builddir_binary ldbmodify "${BINDIR}")
 
 do_provision()
 {
@@ -28,7 +31,7 @@ do_provision()
 add_backup_marker()
 {
 	# manually add the backup marker that the backup cmd usually adds
-	$BINDIR/ldbmodify \
+	${ldbmodify} \
 		-H tdb://$DBPATH/private/sam.ldb <<EOF
 dn: @SAMBA_DSDB
 changetype: modify
diff --git a/testprogs/blackbox/common-links.sh b/testprogs/blackbox/common-links.sh
index 92cf730ffc0..281b0d9c196 100644
--- a/testprogs/blackbox/common-links.sh
+++ b/testprogs/blackbox/common-links.sh
@@ -1,34 +1,11 @@
 release_dir=$SRCDIR_ABS/source4/selftest/provisions/$RELEASE
 
-ldbadd="ldbadd"
-if [ -x "$BINDIR/ldbadd" ]; then
-	ldbadd="$BINDIR/ldbadd"
-fi
-
-ldbmodify="ldbmodify"
-if [ -x "$BINDIR/ldbmodify" ]; then
-	ldbmodify="$BINDIR/ldbmodify"
-fi
-
-ldbdel="ldbdel"
-if [ -x "$BINDIR/ldbdel" ]; then
-	ldbdel="$BINDIR/ldbdel"
-fi
-
-ldbsearch="ldbsearch"
-if [ -x "$BINDIR/ldbsearch" ]; then
-	ldbsearch="$BINDIR/ldbsearch"
-fi
-
-ldbrename="ldbrename"
-if [ -x "$BINDIR/ldbrename" ]; then
-	ldbrename="$BINDIR/ldbrename"
-fi
-
-samba_tdbrestore="tdbrestore"
-if [ -x "$BINDIR/tdbrestore" ]; then
-	samba_tdbrestore="$BINDIR/tdbrestore"
-fi
+ldbadd=$(system_or_builddir_binary ldbadd "${BINDIR}")
+ldbmodify=$(system_or_builddir_binary ldbmodify "${BINDIR}")
+ldbdel=$(system_or_builddir_binary ldbdel "${BINDIR}")
+ldbsearch=$(system_or_builddir_binary ldbsearch "${BINDIR}")
+ldbrename=$(system_or_builddir_binary ldbrename "${BINDIR}")
+samba_tdbrestore=$(system_or_builddir_binary tdbrestore "${BINDIR}")
 
 samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
 
diff --git a/testprogs/blackbox/common_test_fns.inc b/testprogs/blackbox/common_test_fns.inc
index 68465e1e61a..4b9a6a481aa 100755
--- a/testprogs/blackbox/common_test_fns.inc
+++ b/testprogs/blackbox/common_test_fns.inc
@@ -118,9 +118,37 @@ remove_directory()
 	local xdir=${1}
 	shift
 
-	if [ "$xdir" == "/" ] || [ ! -d "$xdir" ] || [ ! $(ls -A "$xdir") ]; then
+	if [ "$xdir" == "/" ] || [ ! -d "$xdir" ] || [ -z "$(ls -A "$xdir")" ]; then
 		return
 	fi
 
 	rm -rf "$xdir"
 }
+
+# This function should be used to either use a system tool or one of our
+# build dir if available.
+#
+# Examples:
+#
+#   system_or_builddir_binary ldbsearch ${BUILDDIR}
+#   system_or_builddir_binary kinit ${BUILDDIR} samba4kinit
+#
+system_or_builddir_binary()
+{
+	_bin_name="${1}"
+	_build_dir="${2}"
+	_alt_bin_name="${3}"
+
+	_bin="$(command -v ${_bin_name})"
+	_bin_build_path="${_build_dir}/${_bin_name}"
+
+	if [ -n "${_alt_bin_name}" ]; then
+	    _bin_build_path="${_build_dir}/${_alt_bin_name}"
+	fi
+
+	if [ -x "${_bin_build_path}" ]; then
+		_bin="${_bin_build_path}"
+	fi
+
+	echo "${_bin}"
+}
diff --git a/testprogs/blackbox/dbcheck-links.sh b/testprogs/blackbox/dbcheck-links.sh
index 29fb5b85abc..aaf93a8cc48 100755
--- a/testprogs/blackbox/dbcheck-links.sh
+++ b/testprogs/blackbox/dbcheck-links.sh
@@ -13,8 +13,8 @@ shift 2
 
 . $(dirname $0)/subunit.sh
 
-. $(dirname $0)/common-links.sh
 . $(dirname $0)/common_test_fns.inc
+. $(dirname $0)/common-links.sh
 
 failed=0
 
diff --git a/testprogs/blackbox/dbcheck-oldrelease.sh b/testprogs/blackbox/dbcheck-oldrelease.sh
index 635ada9414c..afd2d1247ce 100755
--- a/testprogs/blackbox/dbcheck-oldrelease.sh
+++ b/testprogs/blackbox/dbcheck-oldrelease.sh
@@ -18,25 +18,12 @@ failed=0
 
 release_dir=$(dirname $0)/../../source4/selftest/provisions/$RELEASE
 
-ldbmodify="ldbmodify"
-if [ -x "$BINDIR/ldbmodify" ]; then
-	ldbmodify="$BINDIR/ldbmodify"
-fi
-
-ldbdel="ldbdel"
-if [ -x "$BINDIR/ldbdel" ]; then
-	ldbdel="$BINDIR/ldbdel"
-fi
-
-ldbsearch="ldbsearch"
-if [ -x "$BINDIR/ldbsearch" ]; then
-	ldbsearch="$BINDIR/ldbsearch"
-fi
-
-samba_tdbrestore="tdbrestore"
-if [ -x "$BINDIR/tdbrestore" ]; then
-	samba_tdbrestore="$BINDIR/tdbrestore"
-fi
+ldbadd=$(system_or_builddir_binary ldbadd "${BINDIR}")
+ldbmodify=$(system_or_builddir_binary ldbmodify "${BINDIR}")
+ldbdel=$(system_or_builddir_binary ldbdel "${BINDIR}")
+ldbsearch=$(system_or_builddir_binary ldbsearch "${BINDIR}")
+ldbrename=$(system_or_builddir_binary ldbrename "${BINDIR}")
+samba_tdbrestore=$(system_or_builddir_binary tdbrestore "${BINDIR}")
 
 samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
 if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then
diff --git a/testprogs/blackbox/demote-saveddb.sh b/testprogs/blackbox/demote-saveddb.sh
index 56ad136f667..3f296336271 100755
--- a/testprogs/blackbox/demote-saveddb.sh
+++ b/testprogs/blackbox/demote-saveddb.sh
@@ -17,10 +17,7 @@ failed=0
 
 samba_tree_dir="$SRCDIR_ABS/source4/selftest/provisions/multi-dc-samba-master-c596ac6"
 
-samba_tdbrestore="tdbrestore"
-if [ -x $BINDIR/tdbrestore ]; then
-	samba_tdbrestore="$BINDIR/tdbrestore"
-fi
+samba_tdbrestore=$(system_or_builddir_binary tdbrestore "${BINDIR}")
 
 # The undump script and the provision data is not part of release tarballs,
 # skip the tests in this case!
diff --git a/testprogs/blackbox/functionalprep.sh b/testprogs/blackbox/functionalprep.sh
index 9c68047d936..e3cec4c2638 100755
--- a/testprogs/blackbox/functionalprep.sh
+++ b/testprogs/blackbox/functionalprep.sh
@@ -21,10 +21,7 @@ release_dir="$SRCDIR_ABS/source4/selftest/provisions/$RELEASE"
 OLD_RELEASE="release-4-1-0rc3"
 old_release_dir="$SRCDIR_ABS/source4/selftest/provisions/$OLD_RELEASE"
 
-samba_tdbrestore="tdbrestore"
-if [ -x "$BINDIR/tdbrestore" ]; then
-	samba_tdbrestore="$BINDIR/tdbrestore"
-fi
+samba_tdbrestore=$(system_or_builddir_binary tdbrestore "${BINDIR}")
 
 samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
 
diff --git a/testprogs/blackbox/ldapcmp_restoredc.sh b/testprogs/blackbox/ldapcmp_restoredc.sh
index bf3ba321d8f..508b0172091 100755
--- a/testprogs/blackbox/ldapcmp_restoredc.sh
+++ b/testprogs/blackbox/ldapcmp_restoredc.sh
@@ -14,11 +14,9 @@ RESTORED_DC_PREFIX_ABS="$2"
 shift 2
 
 . $(dirname $0)/subunit.sh
+. "$(dirname "${0}")/common_test_fns.inc"
 
-ldbsearch="${VALGRIND} ldbsearch"
-if [ -x "${BINDIR}/ldbsearch" ]; then
-	ldbsearch="${VALGRIND} ${BINDIR}/ldbsearch"
-fi
+ldbsearch=$(system_or_builddir_binary ldbsearch "${BINDIR}")
 
 basedn()
 {
diff --git a/testprogs/blackbox/renamedc.sh b/testprogs/blackbox/renamedc.sh
index 6e24cdfc81d..fc32cad7f06 100755
--- a/testprogs/blackbox/renamedc.sh
+++ b/testprogs/blackbox/renamedc.sh
@@ -10,13 +10,10 @@ fi
 PREFIX="$1"
 shift 1
 
-samba4bindir="$BINDIR"
-ldbsearch="ldbsearch"
-if [ -x "$samba4bindir/ldbsearch" ]; then
-	ldbsearch="$samba4bindir/ldbsearch"
-fi
-
 . $(dirname $0)/subunit.sh
+. "$(dirname "${0}")/common_test_fns.inc"
+
+ldbsearch=$(system_or_builddir_binary ldbsearch "${BINDIR}")
 
 if [ ! -d $PREFIX/renamedc_test ]; then
 	mkdir -p $PREFIX/renamedc_test
diff --git a/testprogs/blackbox/runtime-links.sh b/testprogs/blackbox/runtime-links.sh
index 3862dd973d9..0da06bd7273 100755
--- a/testprogs/blackbox/runtime-links.sh
+++ b/testprogs/blackbox/runtime-links.sh
@@ -15,9 +15,9 @@ failed=0
 
 . $(dirname $0)/subunit.sh
 
+. $(dirname $0)/common_test_fns.inc
 . $(dirname $0)/common-links.sh
 
-. $(dirname $0)/common_test_fns.inc
 
 if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then
 	subunit_start_test $RELEASE
diff --git a/testprogs/blackbox/test_client_kerberos.sh b/testprogs/blackbox/test_client_kerberos.sh
index b436192e768..54554ea3290 100755
--- a/testprogs/blackbox/test_client_kerberos.sh
+++ b/testprogs/blackbox/test_client_kerberos.sh
@@ -28,15 +28,8 @@ samba_rpcclient="$samba_bindir/rpcclient"
 samba_smbclient="$samba_bindir/smbclient"
 samba_smbtorture="$samba_bindir/smbtorture"
 
-samba_kinit=kinit
-if test -x ${samba_bindir}/samba4kinit; then
-	samba_kinit=${samba_bindir}/samba4kinit
-fi
-
-samba_kdestroy=kdestroy
-if test -x ${samba_bindir}/samba4kdestroy; then
-	samba_kinit=${samba_bindir}/samba4kdestroy
-fi
+samba_kinit=$(system_or_builddir_binary kinit "${BINDIR}" samba4kinit)
+samba_kdestroy=$(system_or_builddir_binary kdestroy "${BINDIR}" samba4kdestroy)
 
 test_rpc_getusername()
 {
diff --git a/testprogs/blackbox/test_kinit_heimdal.sh b/testprogs/blackbox/test_kinit_heimdal.sh
index 73b002fb1fe..8e507e3ad93 100755
--- a/testprogs/blackbox/test_kinit_heimdal.sh
+++ b/testprogs/blackbox/test_kinit_heimdal.sh
@@ -38,19 +38,12 @@ fi
 enableaccount="$samba_tool user enable"
 machineaccountccache="$samba4srcdir/scripting/bin/machineaccountccache"
 
-ldbmodify="ldbmodify"
-if [ -x "$samba4bindir/ldbmodify" ]; then
-	ldbmodify="$samba4bindir/ldbmodify"
-fi
-
-ldbsearch="ldbsearch"
-if [ -x "$samba4bindir/ldbsearch" ]; then
-	ldbsearch="$samba4bindir/ldbsearch"
-fi
-
 . $(dirname $0)/subunit.sh
 . $(dirname $0)/common_test_fns.inc
 
+ldbmodify=$(system_or_builddir_binary ldbmodify "${BINDIR}")
+ldbsearch=$(system_or_builddir_binary ldbsearch "${BINDIR}")
+
 enctype="-e $ENCTYPE"
 unc="//$SERVER/tmp"
 
diff --git a/testprogs/blackbox/test_kinit_mit.sh b/testprogs/blackbox/test_kinit_mit.sh
index 2aa44e66568..99111f60de7 100755
--- a/testprogs/blackbox/test_kinit_mit.sh
+++ b/testprogs/blackbox/test_kinit_mit.sh
@@ -32,17 +32,11 @@ samba_texpect="$samba_bindir/texpect"
 samba_enableaccount="$samba_tool user enable"
 machineaccountccache="$samba_srcdir/scripting/bin/machineaccountccache"
 
-ldbmodify="ldbmodify"
-if [ -x "$samba_bindir/ldbmodify" ]; then
-	ldbmodify="$samba_bindir/ldbmodify"
-fi
-
-ldbsearch="ldbsearch"
-if [ -x "$samba_bindir/ldbsearch" ]; then
-	ldbsearch="$samba_bindir/ldbsearch"
-fi
-
 . $(dirname $0)/subunit.sh
+. "$(dirname "${0}")/common_test_fns.inc"
+
+ldbmodify=$(system_or_builddir_binary ldbmodify "${BINDIR}")
+ldbsearch=$(system_or_builddir_binary ldbsearch "${BINDIR}")
 
 test_smbclient()
 {
diff --git a/testprogs/blackbox/test_ktpass.sh b/testprogs/blackbox/test_ktpass.sh
index 81b75445cc6..76cf5b0b3f8 100755
--- a/testprogs/blackbox/test_ktpass.sh
+++ b/testprogs/blackbox/test_ktpass.sh
@@ -15,10 +15,7 @@ shift 1
 samba_tool="$BINDIR/samba-tool"
 samba4bindir="$BINDIR"
 samba4srcdir="$SRCDIR/source4"
-samba4kinit_binary=kinit
-if test -x $BINDIR/samba4kinit; then
-	samba4kinit_binary=$BINDIR/samba4kinit
-fi
+samba4kinit_binary=$(system_or_builddir_binary kinit "${BINDIR}" samba4kinit)
 
 CONFIG="--configfile=$PREFIX/etc/smb.conf"
 
diff --git a/testprogs/blackbox/test_ldb.sh b/testprogs/blackbox/test_ldb.sh
index 0f1f60071f6..eaa4d660a54 100755
--- a/testprogs/blackbox/test_ldb.sh
+++ b/testprogs/blackbox/test_ldb.sh
@@ -14,6 +14,7 @@ shift 2
 options="$*"
 
 . $(dirname $0)/subunit.sh
+. "$(dirname "${0}")/common_test_fns.inc"
 
 check()
 {
@@ -32,9 +33,7 @@ check()
 	return $status
 }
 
-export PATH="$BINDIR:$PATH"
-
-ldbsearch="$VALGRIND ldbsearch"
+ldbsearch="${VALGRIND} $(system_or_builddir_binary ldbsearch "${BINDIR}")"
 
 check "RootDSE" $ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER --scope=base DUMMY=x dnsHostName highestCommittedUSN || failed=$(expr $failed + 1)
 check "RootDSE (full)" $ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER --scope=base '(objectClass=*)' || failed=$(expr $failed + 1)
diff --git a/testprogs/blackbox/test_ldb_simple.sh b/testprogs/blackbox/test_ldb_simple.sh
index 433bacdaf5c..5f5f9b8018f 100755
--- a/testprogs/blackbox/test_ldb_simple.sh
+++ b/testprogs/blackbox/test_ldb_simple.sh
@@ -14,6 +14,7 @@ shift 2
 options="$*"
 
 . $(dirname $0)/subunit.sh
+. "$(dirname "${0}")/common_test_fns.inc"
 
 check()
 {
@@ -32,9 +33,7 @@ check()
 	return $status
 }
 
-export PATH="$BINDIR:$PATH"
-
-ldbsearch="$VALGRIND ldbsearch"
+ldbsearch="${VALGRIND} $(system_or_builddir_binary ldbsearch "${BINDIR}")"
 
 check "currentTime" $ldbsearch $CONFIGURATION $options --basedn='' -H $p://$SERVER --scope=base currentTime || failed=$(expr $failed + 1)
 
diff --git a/testprogs/blackbox/test_net_ads.sh b/testprogs/blackbox/test_net_ads.sh
index b46a0e36489..0f096feb6f3 100755
--- a/testprogs/blackbox/test_net_ads.sh
+++ b/testprogs/blackbox/test_net_ads.sh
@@ -26,28 +26,14 @@ failed=0
 
 net_tool="$BINDIR/net --configfile=$BASEDIR/$WORKDIR/client.conf --option=security=ads"
 
-ldbsearch="ldbsearch"
-if [ -x "$BINDIR/ldbsearch" ]; then
-	ldbsearch="$BINDIR/ldbsearch"


-- 
Samba Shared Repository



More information about the samba-cvs mailing list