At file:///home/jelmer/bzr.samba/3.0-perltest/ ------------------------------------------------------------ revno: 5429 revision-id: [EMAIL PROTECTED] parent: svn-v2:[EMAIL PROTECTED] committer: Jelmer Vernooij <[EMAIL PROTECTED]> branch nick: 3.0-perltest timestamp: Wed 2007-03-21 03:26:07 +0100 message: Move test environment create code to a separate script. added: source/script/tests/mktestsetup.sh mktestsetup.sh-20070321012023-5402h6n35mf9lpz0-1 modified: source/script/tests/selftest.sh svn-v2:[EMAIL PROTECTED] === added file 'source/script/tests/mktestsetup.sh' --- a/source/script/tests/mktestsetup.sh 1970-01-01 00:00:00 +0000 +++ b/source/script/tests/mktestsetup.sh 2007-03-21 02:26:07 +0000 @@ -0,0 +1,136 @@ +#!/bin/sh +# Setup a Samba 3 DC for testing +# Copyright (C) 2006 Stefan (metze) Metzmacher +# Copyright (C) 2007 Jelmer Vernooij +# Published under the GNU GPL, v2 or later. + +if [ $# -lt 1 ] +then + echo "$0 PREFIX" + exit 1 +fi + +PREFIX=$1 + +## +## setup the various environment variables we need +## + +SERVER=localhost2 +SERVER_IP=127.0.0.2 +USERNAME=`PATH=/usr/ucb:$PATH whoami` +PASSWORD=test + +SRCDIR="`dirname $0`/../.." +BINDIR="`pwd`/bin" +SCRIPTDIR=$SRCDIR/script/tests +SHRDIR=$PREFIX_ABS/tmp +LIBDIR=$PREFIX_ABS/lib +PIDDIR=$PREFIX_ABS/pid +CONFFILE=$LIBDIR/client.conf +SERVERCONFFILE=$LIBDIR/server.conf +COMMONCONFFILE=$LIBDIR/common.conf +PRIVATEDIR=$PREFIX_ABS/private +LOCKDIR=$PREFIX_ABS/lockdir +LOGDIR=$PREFIX_ABS/logs +CONFIGURATION="-s $CONFFILE" + +export PREFIX PREFIX_ABS +export CONFIGURATION CONFFILE +export PATH SOCKET_WRAPPER_DIR DOMAIN +export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE +export SRCDIR SCRIPTDIR BINDIR +export USERNAME PASSWORD +export SERVER SERVER_IP + +## +## create the test directory layout +## +echo -n "CREATE TEST ENVIRONMENT IN '$PREFIX'"... +/bin/rm -rf $PREFIX/* +mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR $SOCKET_WRAPPER_DIR +mkdir -p $PREFIX_ABS/tmp +chmod 777 $PREFIX_ABS/tmp + +## +## Create the common config include file with the basic settings +## + +cat >$COMMONCONFFILE<<EOF + workgroup = SAMBA-TEST + + private dir = $PRIVATEDIR + pid directory = $PIDDIR + lock directory = $LOCKDIR + log file = $LOGDIR/log.%m + log level = 0 + + name resolve order = bcast +EOF + +cat >$CONFFILE<<EOF +[global] + netbios name = TORTURE_6 + interfaces = $TORTURE_INTERFACES + panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY) + include = $COMMONCONFFILE + + passdb backend = tdbsam +EOF + +cat >$SERVERCONFFILE<<EOF +[global] + netbios name = $SERVER + interfaces = $SERVER_IP/8 + bind interfaces only = yes + panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY) + include = $COMMONCONFFILE + + passdb backend = tdbsam + + ; Necessary to add the build farm hacks + add user script = /bin/false + add machine script = /bin/false + + kernel oplocks = no + kernel change notify = no + + syslog = no + printing = bsd + printcap name = /dev/null + +[tmp] + path = $PREFIX_ABS/tmp + read only = no + smbd:sharedelay = 100000 + map hidden = yes + map system = yes + create mask = 755 +[hideunread] + copy = tmp + hide unreadable = yes +[hideunwrite] + copy = tmp + hide unwriteable files = yes +[print1] + copy = tmp + printable = yes + printing = test +[print2] + copy = print1 +[print3] + copy = print1 +[print4] + copy = print1 +EOF + +## +## create a test account +## + +(echo $PASSWORD; echo $PASSWORD) | \ + smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1 + +echo "DONE"; + +
=== modified file 'source/script/tests/selftest.sh' --- a/source/script/tests/selftest.sh 2007-03-08 21:30:15 +0000 +++ b/source/script/tests/selftest.sh 2007-03-21 02:26:07 +0000 @@ -24,92 +24,30 @@ export TORTURE_MAXTIME ## -## setup the various environment variables we need +## verify that we were built with --enable-socket-wrapper ## -SERVER=localhost2 -SERVER_IP=127.0.0.2 -USERNAME=`PATH=/usr/ucb:$PATH whoami` -PASSWORD=test - -SRCDIR="`dirname $0`/../.." -BINDIR="`pwd`/bin" -SCRIPTDIR=$SRCDIR/script/tests -SHRDIR=$PREFIX_ABS/tmp -LIBDIR=$PREFIX_ABS/lib -PIDDIR=$PREFIX_ABS/pid -CONFFILE=$LIBDIR/client.conf +if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then + echo "***" + echo "*** You must include --enable-socket-wrapper when compiling Samba" + echo "*** in order to execute 'make test'. Exiting...." + echo "***" + exit 1 +fi + +. ./script/tests/mktestsetup.sh $PREFIX + +SOCKET_WRAPPER_DIR=$PREFIX/sw SAMBA4CONFFILE=$LIBDIR/samba4client.conf -SERVERCONFFILE=$LIBDIR/server.conf -COMMONCONFFILE=$LIBDIR/common.conf -PRIVATEDIR=$PREFIX_ABS/private -LOCKDIR=$PREFIX_ABS/lockdir -LOGDIR=$PREFIX_ABS/logs -SOCKET_WRAPPER_DIR=$PREFIX/sw -CONFIGURATION="-s $CONFFILE" SAMBA4CONFIGURATION="-s $SAMBA4CONFFILE" - -export PREFIX PREFIX_ABS -export CONFIGURATION CONFFILE SAMBA4CONFIGURATION SAMBA4CONFFILE -export PATH SOCKET_WRAPPER_DIR DOMAIN -export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE -export SRCDIR SCRIPTDIR BINDIR -export USERNAME PASSWORD export SMBTORTURE4 -export SERVER SERVER_IP +export SAMBA4CONFIGURATION SAMBA4CONFFILE PATH=bin:$PATH export PATH -## -## verify that we were built with --enable-socket-wrapper -## - -if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then - echo "***" - echo "*** You must include --enable-socket-wrapper when compiling Samba" - echo "*** in order to execute 'make test'. Exiting...." - echo "***" - exit 1 -fi - -## -## create the test directory layout -## -echo -n "CREATE TEST ENVIRONMENT IN '$PREFIX'"... -/bin/rm -rf $PREFIX/* -mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR $SOCKET_WRAPPER_DIR -mkdir -p $PREFIX_ABS/tmp -chmod 777 $PREFIX_ABS/tmp - -## -## Create the common config include file with the basic settings -## - -cat >$COMMONCONFFILE<<EOF - workgroup = SAMBA-TEST - - private dir = $PRIVATEDIR - pid directory = $PIDDIR - lock directory = $LOCKDIR - log file = $LOGDIR/log.%m - log level = 0 - - name resolve order = bcast -EOF - TORTURE_INTERFACES='127.0.0.6/8,127.0.0.7/8,127.0.0.8/8,127.0.0.9/8,127.0.0.10/8,127.0.0.11/8' -cat >$CONFFILE<<EOF -[global] - netbios name = TORTURE_6 - interfaces = $TORTURE_INTERFACES - panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY) - include = $COMMONCONFFILE - - passdb backend = tdbsam -EOF - cat >$SAMBA4CONFFILE<<EOF [global] netbios name = TORTURE_6 @@ -118,61 +56,6 @@ include = $COMMONCONFFILE EOF -cat >$SERVERCONFFILE<<EOF -[global] - netbios name = $SERVER - interfaces = $SERVER_IP/8 - bind interfaces only = yes - panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY) - include = $COMMONCONFFILE - - passdb backend = tdbsam - - ; Necessary to add the build farm hacks - add user script = /bin/false - add machine script = /bin/false - - kernel oplocks = no - kernel change notify = no - - syslog = no - printing = bsd - printcap name = /dev/null - -[tmp] - path = $PREFIX_ABS/tmp - read only = no - smbd:sharedelay = 100000 - map hidden = yes - map system = yes - create mask = 755 -[hideunread] - copy = tmp - hide unreadable = yes -[hideunwrite] - copy = tmp - hide unwriteable files = yes -[print1] - copy = tmp - printable = yes - printing = test -[print2] - copy = print1 -[print3] - copy = print1 -[print4] - copy = print1 -EOF - -## -## create a test account -## - -(echo $PASSWORD; echo $PASSWORD) | \ - smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1 - -echo "DONE"; - SERVER_TEST_FIFO="$PREFIX/server_test.fifo" export SERVER_TEST_FIFO NMBD_TEST_LOG="$PREFIX/nmbd_test.log"