From 36ca11b00a1432654819d9fca75be56ab827e3ca Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 4 Sep 2006 00:32:46 +0000 Subject: r18023: Add support infrusructure for testing against an OpenLDAP server. This will give a bit more noise on platforms without OpenLDAP (when we run the slaptest check), but it shouldn't be too bad. We don't start the LDAP server or re-provision unless LDAP_TEST is set. Andrew Bartlett (This used to be commit 999d989131f41d0218ec05595c9761aff5bbf5fa) --- source4/script/tests/mktestsetup.sh | 82 +++++++++++++++++++++++++++++++--- source4/script/tests/selftest.sh | 16 ++++++- source4/script/tests/test_functions.sh | 10 +++++ 3 files changed, 102 insertions(+), 6 deletions(-) (limited to 'source4/script/tests') diff --git a/source4/script/tests/mktestsetup.sh b/source4/script/tests/mktestsetup.sh index eaa332035d..1814e960fd 100755 --- a/source4/script/tests/mktestsetup.sh +++ b/source4/script/tests/mktestsetup.sh @@ -19,6 +19,8 @@ fi DOMAIN=SAMBADOMAIN USERNAME=administrator REALM=SAMBA.EXAMPLE.COM +DNSNAME="samba.example.com" +BASEDN="dc=samba,dc=example,dc=com" PASSWORD=penguin SRCDIR=`pwd` ROOT=$USER @@ -57,11 +59,15 @@ CERTFILE=$TLSDIR/cert.pem KEYFILE=$TLSDIR/key.pem WINBINDD_SOCKET_DIR=$PREFIX_ABS/winbind_socket CONFIGURATION="--configfile=$CONFFILE" +LDAPDIR=$PREFIX_ABS/ldap +SLAPD_CONF=$LDAPDIR/slapd.conf export CONFIGURATION export CONFFILE +export SLAPD_CONF +export PIDDIR rm -rf $PREFIX/* -mkdir -p $PRIVATEDIR $ETCDIR $PIDDIR $NCALRPCDIR $LOCKDIR $TMPDIR $TLSDIR +mkdir -p $PRIVATEDIR $ETCDIR $PIDDIR $NCALRPCDIR $LOCKDIR $TMPDIR $TLSDIR $LDAPDIR/db cat >$CONFFILE<$KRB5_CONFIG<$DHFILE<$SLAPD_CONF < /dev/null 2>&1; then + echo "enabling slapd modules" + cat > $MODCONF <$PRIVATEDIR/wins_config.ldif</dev/null || exit 1 + diff --git a/source4/script/tests/selftest.sh b/source4/script/tests/selftest.sh index e28aaf60df..b09399f032 100755 --- a/source4/script/tests/selftest.sh +++ b/source4/script/tests/selftest.sh @@ -3,7 +3,7 @@ if [ $# -lt 1 ] then - echo "$0 PREFIX" + echo "$0 PREFIX TESTS" exit fi @@ -54,6 +54,16 @@ fi incdir=`dirname $ARG0` . $incdir/test_functions.sh +#Start slapd before smbd +if [ x"$TEST_LDAP" = x"yes" ]; then + slapd_start + echo -n "LDAP PROVISIONING..." + if ! $srcdir/bin/smbscript $srcdir/setup/provision $PROVISION_OPTIONS --ldap-backend=$LDAPI; then + echo "LDAP PROVISIONING failed: $srcdir/bin/smbscript $srcdir/setup/provision $PROVISION_OPTIONS --ldap-backend=$LDAPI" + exit 1; + fi +fi + SMBD_TEST_FIFO="$PREFIX/smbd_test.fifo" export SMBD_TEST_FIFO SMBD_TEST_LOG="$PREFIX/smbd_test.log" @@ -100,6 +110,10 @@ failed=$? kill `cat $PIDDIR/smbd.pid` +if [ "$TEST_LDAP"x = "yesx" ]; then + kill `cat $PIDDIR/slapd.pid` +fi + END=`date` echo "START: $START ($ARG0)"; echo "END: $END ($ARG0)"; diff --git a/source4/script/tests/test_functions.sh b/source4/script/tests/test_functions.sh index f92f4c6632..9efe204a35 100755 --- a/source4/script/tests/test_functions.sh +++ b/source4/script/tests/test_functions.sh @@ -65,6 +65,16 @@ smbd_have_test_log() { return 1; } +slapd_start() { + OLDPATH=$PATH + PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH + export PATH + slapd -f $SLAPD_CONF -h $LDAPI_ESCAPE + PATH=$OLDPATH + export PATH + return 0; +} + testit() { if [ -z "$PREFIX" ]; then PREFIX=test_prefix -- cgit