aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2016-11-27 18:37:12 -0500
committerTom Yu <tlyu@mit.edu>2017-01-09 17:14:20 -0500
commitc6ceceb17d91a69d1c14cab19e0b10e78ddec353 (patch)
tree8fffb21219e46ecf88a37bef4c3079a0afe5efad
parentc5eb1e3ebc448747251c3d967497f662cedbcde7 (diff)
downloadkrb5-c6ceceb17d91a69d1c14cab19e0b10e78ddec353.zip
krb5-c6ceceb17d91a69d1c14cab19e0b10e78ddec353.tar.gz
krb5-c6ceceb17d91a69d1c14cab19e0b10e78ddec353.tar.bz2
Allow slapd path configuration in t_kdb.py
The upstream OpenLDAP installs slapd in libexec, which is not typically in the path. Also, copying the binary can sometimes cause it to fail; for instance, in the OpenCSW package, /opt/csw/libexec/slapd is a script which chooses a binary based on the system architecture and the path to the script. Allow the test runner to set the SLAPD environment variable to specify the slapd location and avoid the copy. (cherry picked from commit 9290e52b7f206dcbfd9dd5d873cf9379cb9de760) ticket: 8521 version_fixed: 1.14.5
-rwxr-xr-xsrc/tests/t_kdb.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/tests/t_kdb.py b/src/tests/t_kdb.py
index 28c672c..79d4c89 100755
--- a/src/tests/t_kdb.py
+++ b/src/tests/t_kdb.py
@@ -12,12 +12,10 @@ if (not os.path.exists(os.path.join(plugins, 'kdb', 'kldap.so')) and
not os.path.exists(os.path.join(buildtop, 'lib', 'libkdb_ldap.a'))):
skip_rest('LDAP KDB tests', 'LDAP KDB module not built')
-system_slapd = which('slapd')
-if not system_slapd:
+if 'SLAPD' not in os.environ and not which('slapd'):
skip_rest('LDAP KDB tests', 'slapd not found')
ldapdir = os.path.abspath('ldap')
-slapd = os.path.join(ldapdir, 'slapd')
dbdir = os.path.join(ldapdir, 'ldap')
slapd_conf = os.path.join(ldapdir, 'slapd.conf')
slapd_out = os.path.join(ldapdir, 'slapd.out')
@@ -35,10 +33,15 @@ shutil.rmtree(ldapdir, True)
os.mkdir(ldapdir)
os.mkdir(dbdir)
-# Some Linux installations have AppArmor or similar restrictions on
-# the slapd binary, which would prevent it from accessing the build
-# directory. Try to defeat this by copying the binary.
-shutil.copy(system_slapd, slapd)
+if 'SLAPD' in os.environ:
+ slapd = os.environ['SLAPD']
+else:
+ # Some Linux installations have AppArmor or similar restrictions
+ # on the slapd binary, which would prevent it from accessing the
+ # build directory. Try to defeat this by copying the binary.
+ system_slapd = which('slapd')
+ slapd = os.path.join(ldapdir, 'slapd')
+ shutil.copy(system_slapd, slapd)
# Find the core schema file if we can.
core_schema = None