summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2011-04-15 19:10:57 +0000
committerArthur de Jong <arthur@arthurdejong.org>2011-04-15 19:10:57 +0000
commit984cee3efe542f992e64d57660e842065a5cf018 (patch)
tree67f6a4bfde6147e5dc6d05dd2d2761f4a84e9359
parent31bbfebc95577f5df9be8ec70640180ec105fb02 (diff)
allow running test_{nss,pam}cmds tests from another directory
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1424 ef36b2f9-881f-0410-afb5-c4e39611909c
-rwxr-xr-xtests/test_nsscmds.sh2
-rw-r--r--tests/test_pamcmds.expect6
-rwxr-xr-xtests/test_pamcmds.sh5
3 files changed, 9 insertions, 4 deletions
diff --git a/tests/test_nsscmds.sh b/tests/test_nsscmds.sh
index 33efae6..743752e 100755
--- a/tests/test_nsscmds.sh
+++ b/tests/test_nsscmds.sh
@@ -27,7 +27,7 @@
set -e
# find source directory
-srcdir="${srcdir-"."}"
+srcdir="${srcdir-`dirname "$0"`}"
# ensure that we are running in the test environment
. "$srcdir/in_testenv.sh"
diff --git a/tests/test_pamcmds.expect b/tests/test_pamcmds.expect
index bc80b86..586a889 100644
--- a/tests/test_pamcmds.expect
+++ b/tests/test_pamcmds.expect
@@ -48,13 +48,17 @@ proc reset_password {} {
#close
}
+# find source directory
+if { ! [info exists ::env(srcdir) ] } {
+ set env(srcdir) "."
+}
# ensure that we are running as root
if { [exec id -u] != "0" } {
send_user "test_pamcmds.expect: not running as root\n"
exit 77
}
# ensure that we are running in the test environment
-spawn ./in_testenv.sh
+spawn $env(srcdir)/in_testenv.sh
expect {
"in_testenv.sh: using LDAP server" { expect eof }
eof {
diff --git a/tests/test_pamcmds.sh b/tests/test_pamcmds.sh
index cb8bf21..798cafd 100755
--- a/tests/test_pamcmds.sh
+++ b/tests/test_pamcmds.sh
@@ -22,7 +22,7 @@
set -e
# find source directory
-srcdir="${srcdir-"."}"
+srcdir="${srcdir-`dirname "$0"`}"
# ensure that we are running in the test environment
. "$srcdir/in_testenv.sh"
@@ -35,4 +35,5 @@ then
exit 77
fi
-"$EXPECT" ./test_pamcmds.expect
+export srcdir
+"$EXPECT" "$srcdir/test_pamcmds.expect"