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`
36 SCRIPTDIR=$SRCDIR/script/tests
37 SHRDIR=$PREFIX_ABS/tmp
38 LIBDIR=$PREFIX_ABS/lib
39 PIDDIR=$PREFIX_ABS/pid
40 CONFFILE=$LIBDIR/client.conf
41 SERVERCONFFILE=$LIBDIR/server.conf
42 COMMONCONFFILE=$LIBDIR/common.conf
43 PRIVATEDIR=$PREFIX_ABS/private
44 LOCKDIR=$PREFIX_ABS/lockdir
45 LOGDIR=$PREFIX_ABS/logs
46 SOCKET_WRAPPER_DIR=$PREFIX/sw
47 CONFIGURATION="-s $CONFFILE"
49 export PREFIX PREFIX_ABS CONFIGURATION CONFFILE PATH SOCKET_WRAPPER_DIR DOMAIN
50 export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE
51 export SRCDIR SCRIPTDIR
52 export USERNAME PASSWORD
54 export SERVER SERVER_IP
60 ## verify that we were built with --enable-socket-wrapper
63 if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then
65 echo "*** You must include --enable-socket-wrapper when compiling Samba"
66 echo "*** in order to execute 'make test'. Exiting...."
72 ## create the test directory layout
74 echo -n "CREATE TEST ENVIRONMENT IN '$PREFIX'"...
76 mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR $SOCKET_WRAPPER_DIR
77 mkdir -p $PREFIX_ABS/tmp
78 chmod 777 $PREFIX_ABS/tmp
81 ## Create the common config include file with the basic settings
84 cat >$COMMONCONFFILE<<EOF
85 workgroup = SAMBA-TEST
87 private dir = $PRIVATEDIR
88 pid directory = $PIDDIR
89 lock directory = $LOCKDIR
90 log file = $LOGDIR/log.%m
93 passdb backend = tdbsam
95 name resolve order = bcast
97 panic action = $SCRIPTDIR/gdb_backtrace %d
102 netbios name = TORTURE26
103 interfaces = 127.0.0.26/8
104 include = $COMMONCONFFILE
107 cat >$SERVERCONFFILE<<EOF
109 netbios name = $SERVER
110 interfaces = $SERVER_IP/8
111 bind interfaces only = yes
112 include = $COMMONCONFFILE
114 ; Necessary to add the build farm hacks
115 add user script = /bin/false
116 add machine script = /bin/false
121 path = $PREFIX_ABS/tmp
123 smbd:sharedelay = 100000
126 hide unreadable = yes
129 hide unwriteable files = yes
134 ## create a test account
137 (echo $PASSWORD; echo $PASSWORD) | \
138 smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1
142 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
143 CONFIGURATION="$CONFIGURATION --option=\"torture:progress=no\""
146 SERVER_TEST_FIFO="$PREFIX/server_test.fifo"
147 export SERVER_TEST_FIFO
148 NMBD_TEST_LOG="$PREFIX/nmbd_test.log"
150 SMBD_TEST_LOG="$PREFIX/smbd_test.log"
153 # start off with 0 failures
157 . $SCRIPTDIR/test_functions.sh
159 SOCKET_WRAPPER_DEFAULT_IFACE=2
160 export SOCKET_WRAPPER_DEFAULT_IFACE
161 samba3_check_or_start
163 # ensure any one smbtorture call doesn't run too long
164 # and smbtorture will use 127.0.0.26 as source address by default
165 SOCKET_WRAPPER_DEFAULT_IFACE=26
166 export SOCKET_WRAPPER_DEFAULT_IFACE
167 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'
168 TORTURE4_OPTIONS="--maximum-runtime=$TORTURE_MAXTIME --option=interfaces=$TORTURE4_INTERFACES $CONFIGURATION"
169 export TORTURE4_OPTIONS
171 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
172 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:progress=no"
175 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=target:samba3=yes"
178 ## ready to go...now loop through the tests
183 # give time for nbt server to register its names
184 echo "delaying for nbt name registration"
186 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init
187 bin/nmblookup $CONFIGURATION -U $SERVER_IP __SAMBA__
188 bin/nmblookup $CONFIGURATION __SAMBA__
189 bin/nmblookup $CONFIGURATION -U 127.255.255.255 __SAMBA__
190 bin/nmblookup $CONFIGURATION -U $SERVER_IP $SERVER
191 bin/nmblookup $CONFIGURATION $SERVER
192 # make sure smbd is also up set
194 bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
195 bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
199 . $SCRIPTDIR/tests_$TESTS.sh
207 echo "START: $START ($0)";
208 echo "END: $END ($0)";
210 # if there were any valgrind failures, show them
211 count=`find $PREFIX -name 'valgrind.log*' | wc -l`
212 if [ "$count" != 0 ]; then
213 for f in $PREFIX/valgrind.log*; do
215 echo "VALGRIND FAILURE";
216 failed=`expr $failed + 1`
225 teststatus $0 $failed