4 echo "$0 <directory> <all | quick> <smbtorture4>"
12 ## create the test directory
14 PREFIX=`echo $1 | sed s+//+/+`
15 mkdir -p $PREFIX || exit $?
21 if [ -z "$TORTURE_MAXTIME" ]; then
24 export TORTURE_MAXTIME
27 ## setup the various environment variables we need
32 USERNAME=`PATH=/usr/ucb:$PATH whoami`
35 SRCDIR="`dirname $0`/../.."
37 SCRIPTDIR=$SRCDIR/script/tests
38 SHRDIR=$PREFIX_ABS/tmp
39 LIBDIR=$PREFIX_ABS/lib
40 PIDDIR=$PREFIX_ABS/pid
41 CONFFILE=$LIBDIR/client.conf
42 SERVERCONFFILE=$LIBDIR/server.conf
43 COMMONCONFFILE=$LIBDIR/common.conf
44 PRIVATEDIR=$PREFIX_ABS/private
45 LOCKDIR=$PREFIX_ABS/lockdir
46 LOGDIR=$PREFIX_ABS/logs
47 SOCKET_WRAPPER_DIR=$PREFIX/sw
48 CONFIGURATION="-s $CONFFILE"
50 export PREFIX PREFIX_ABS CONFIGURATION CONFFILE PATH SOCKET_WRAPPER_DIR DOMAIN
51 export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE
52 export SRCDIR SCRIPTDIR BINDIR
53 export USERNAME PASSWORD
55 export SERVER SERVER_IP
61 ## verify that we were built with --enable-socket-wrapper
64 if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then
66 echo "*** You must include --enable-socket-wrapper when compiling Samba"
67 echo "*** in order to execute 'make test'. Exiting...."
73 ## create the test directory layout
75 echo -n "CREATE TEST ENVIRONMENT IN '$PREFIX'"...
77 mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR $SOCKET_WRAPPER_DIR
78 mkdir -p $PREFIX_ABS/tmp
79 chmod 777 $PREFIX_ABS/tmp
82 ## Create the common config include file with the basic settings
85 cat >$COMMONCONFFILE<<EOF
86 workgroup = SAMBA-TEST
88 private dir = $PRIVATEDIR
89 pid directory = $PIDDIR
90 lock directory = $LOCKDIR
91 log file = $LOGDIR/log.%m
94 passdb backend = tdbsam
96 name resolve order = bcast
98 panic action = $SCRIPTDIR/gdb_backtrace %d
103 netbios name = TORTURE26
104 interfaces = 127.0.0.26/8
105 include = $COMMONCONFFILE
108 cat >$SERVERCONFFILE<<EOF
110 netbios name = $SERVER
111 interfaces = $SERVER_IP/8
112 bind interfaces only = yes
113 include = $COMMONCONFFILE
115 ; Necessary to add the build farm hacks
116 add user script = /bin/false
117 add machine script = /bin/false
122 printcap name = /dev/null
125 path = $PREFIX_ABS/tmp
127 smbd:sharedelay = 100000
130 hide unreadable = yes
133 hide unwriteable files = yes
138 ## create a test account
141 (echo $PASSWORD; echo $PASSWORD) | \
142 smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1
146 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
147 CONFIGURATION="$CONFIGURATION --option=\"torture:progress=no\""
150 SERVER_TEST_FIFO="$PREFIX/server_test.fifo"
151 export SERVER_TEST_FIFO
152 NMBD_TEST_LOG="$PREFIX/nmbd_test.log"
154 SMBD_TEST_LOG="$PREFIX/smbd_test.log"
157 # start off with 0 failures
161 . $SCRIPTDIR/test_functions.sh
163 SOCKET_WRAPPER_DEFAULT_IFACE=2
164 export SOCKET_WRAPPER_DEFAULT_IFACE
165 samba3_check_or_start
167 # ensure any one smbtorture call doesn't run too long
168 # and smbtorture will use 127.0.0.26 as source address by default
169 SOCKET_WRAPPER_DEFAULT_IFACE=26
170 export SOCKET_WRAPPER_DEFAULT_IFACE
171 TORTURE4_INTERFACES='127.0.0.26/8,127.0.0.27/8,127.0.0.28/8,127.0.0.29/8,127.0.0.30/8,127.0.0.31/8'
172 TORTURE4_OPTIONS="--maximum-runtime=$TORTURE_MAXTIME --option=interfaces=$TORTURE4_INTERFACES $CONFIGURATION"
173 export TORTURE4_OPTIONS
175 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
176 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:progress=no"
179 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=target:samba3=yes"
182 ## ready to go...now loop through the tests
187 # give time for nbt server to register its names
188 echo "delaying for nbt name registration"
190 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init
191 bin/nmblookup $CONFIGURATION -U $SERVER_IP __SAMBA__
192 bin/nmblookup $CONFIGURATION __SAMBA__
193 bin/nmblookup $CONFIGURATION -U 127.255.255.255 __SAMBA__
194 bin/nmblookup $CONFIGURATION -U $SERVER_IP $SERVER
195 bin/nmblookup $CONFIGURATION $SERVER
196 # make sure smbd is also up set
198 bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
199 bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
203 . $SCRIPTDIR/tests_$TESTS.sh
211 echo "START: $START ($0)";
212 echo "END: $END ($0)";
214 # if there were any valgrind failures, show them
215 count=`find $PREFIX -name 'valgrind.log*' | wc -l`
216 if [ "$count" != 0 ]; then
217 for f in $PREFIX/valgrind.log*; do
219 echo "VALGRIND FAILURE";
220 failed=`expr $failed + 1`
229 teststatus $0 $failed