Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2015-03-21 18:54:32 +0100
committerArthur de Jong <arthur@arthurdejong.org>2015-03-22 20:08:52 +0100
commit0420232b7989c99ad7992f0f10a47f3f48a28fc7 (patch)
tree287f91e8f3ad9006da58a266545bf5c637c1b97c /tests
parent788475f94b27e3583e4bb35d8a7643fe9ff6719d (diff)
Various small fixes when using --with-module-name
This updates the test framework to support --with-module-name, ensures that exports.map is rebuilt when configure is re-ran, fixes parsing of nsswitch.conf (to determine what to return for passwd lookups) and fixes the check for _nss_ldap_version.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/testenv.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/testenv.sh b/tests/testenv.sh
index 6b59873..4d807b8 100755
--- a/tests/testenv.sh
+++ b/tests/testenv.sh
@@ -2,7 +2,7 @@
# testenv.sh - script to check test environment
#
-# Copyright (C) 2011, 2013 Arthur de Jong
+# Copyright (C) 2011-2015 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -24,16 +24,24 @@ set -e
# get the script name
script="`basename "$0"`"
-# find source directory (used for finding auxiliary files)
+# find source and build directory (used for finding auxiliary files)
srcdir="${srcdir-`dirname "$0"`}"
+builddir="${builddir-`dirname "$0"`}"
# location of nslcd configuration file
nslcd_cfg="${nslcd_cfg-/etc/nslcd.conf}"
+# the configured module name (usually ldap)
+if [ -f "$builddir"/../config.h ]
+then
+ module_name=`sed -n 's/^#define MODULE_NAME "\(.*\)"$/\1/p' "$builddir"/../config.h`
+fi
+module_name="${module_name-ldap}"
+
# find the names of services that are configured to use LDAP
nss_list_configured()
{
- sed -n 's/^[ \t]*\([a-z]*\)[ \t]*:.*[ \t]ldap.*$/\1/p' /etc/nsswitch.conf \
+ sed -n 's/^[ \t]*\([a-z]*\)[ \t]*:.*[ \t]'$module_name'.*$/\1/p' /etc/nsswitch.conf \
| xargs
}
@@ -41,7 +49,7 @@ nss_list_configured()
nss_is_enabled()
{
name="$1"
- grep '^[ \t]*'$name'[ \t]*:.*ldap.*' /etc/nsswitch.conf > /dev/null
+ grep '^[ \t]*'$name'[ \t]*:.*'$module_name'.*' /etc/nsswitch.conf > /dev/null
}
# check to see if name is configured to do lookups through
@@ -57,10 +65,10 @@ nss_enable()
if grep -q '^[ \t]*'$name'[ \t]*:' /etc/nsswitch.conf
then
# modify an existing entry by just adding ldap to the end
- sed -i 's/^\([ \t]*'$name'[ \t]*:.*[^ \t]\)[ \t]*$/\1 ldap/' /etc/nsswitch.conf
+ sed -i 's/^\([ \t]*'$name'[ \t]*:.*[^ \t]\)[ \t]*$/\1 '$module_name'/' /etc/nsswitch.conf
else
# append a new line
- printf '%-15s ldap\n' $name':' >> /etc/nsswitch.conf
+ printf '%-15s '$module_name'\n' $name':' >> /etc/nsswitch.conf
fi
# invalidate nscd cache
nscd -i "$name" > /dev/null 2>&1 || true