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 SAMBA4CONFFILE=$LIBDIR/samba4client.conf
43 SERVERCONFFILE=$LIBDIR/server.conf
44 COMMONCONFFILE=$LIBDIR/common.conf
45 PRIVATEDIR=$PREFIX_ABS/private
46 LOCKDIR=$PREFIX_ABS/lockdir
47 LOGDIR=$PREFIX_ABS/logs
48 SOCKET_WRAPPER_DIR=$PREFIX/sw
49 CONFIGURATION="-s $CONFFILE"
50 SAMBA4CONFIGURATION="-s $SAMBA4CONFFILE"
52 export PREFIX PREFIX_ABS
53 export CONFIGURATION CONFFILE SAMBA4CONFIGURATION SAMBA4CONFFILE
54 export PATH SOCKET_WRAPPER_DIR DOMAIN
55 export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE
56 export SRCDIR SCRIPTDIR BINDIR
57 export USERNAME PASSWORD
59 export SERVER SERVER_IP
65 ## verify that we were built with --enable-socket-wrapper
68 if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then
70 echo "*** You must include --enable-socket-wrapper when compiling Samba"
71 echo "*** in order to execute 'make test'. Exiting...."
77 ## create the test directory layout
79 echo -n "CREATE TEST ENVIRONMENT IN '$PREFIX'"...
81 mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR $SOCKET_WRAPPER_DIR
82 mkdir -p $PREFIX_ABS/tmp
83 chmod 777 $PREFIX_ABS/tmp
86 ## Create the common config include file with the basic settings
89 cat >$COMMONCONFFILE<<EOF
90 workgroup = SAMBA-TEST
92 private dir = $PRIVATEDIR
93 pid directory = $PIDDIR
94 lock directory = $LOCKDIR
95 log file = $LOGDIR/log.%m
98 passdb backend = tdbsam
100 name resolve order = bcast
105 netbios name = TORTURE26
106 interfaces = 127.0.0.26/8
107 panic action = $SCRIPTDIR/gdb_backtrace %d
108 include = $COMMONCONFFILE
111 cat >$SAMBA4CONFFILE<<EOF
113 netbios name = TORTURE26
114 interfaces = 127.0.0.26/8
115 panic action = $SCRIPTDIR/gdb_backtrace %PID% %PROG%
116 include = $COMMONCONFFILE
119 cat >$SERVERCONFFILE<<EOF
121 netbios name = $SERVER
122 interfaces = $SERVER_IP/8
123 bind interfaces only = yes
124 panic action = $SCRIPTDIR/gdb_backtrace %d
125 include = $COMMONCONFFILE
127 ; Necessary to add the build farm hacks
128 add user script = /bin/false
129 add machine script = /bin/false
134 printcap name = /dev/null
137 path = $PREFIX_ABS/tmp
139 smbd:sharedelay = 100000
142 hide unreadable = yes
145 hide unwriteable files = yes
149 ## create a test account
152 (echo $PASSWORD; echo $PASSWORD) | \
153 smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1
157 SERVER_TEST_FIFO="$PREFIX/server_test.fifo"
158 export SERVER_TEST_FIFO
159 NMBD_TEST_LOG="$PREFIX/nmbd_test.log"
161 SMBD_TEST_LOG="$PREFIX/smbd_test.log"
164 # start off with 0 failures
168 . $SCRIPTDIR/test_functions.sh
170 SOCKET_WRAPPER_DEFAULT_IFACE=2
171 export SOCKET_WRAPPER_DEFAULT_IFACE
172 samba3_check_or_start
174 # ensure any one smbtorture call doesn't run too long
175 # and smbtorture will use 127.0.0.26 as source address by default
176 SOCKET_WRAPPER_DEFAULT_IFACE=26
177 export SOCKET_WRAPPER_DEFAULT_IFACE
178 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'
179 TORTURE4_OPTIONS="--option=interfaces=$TORTURE4_INTERFACES $SAMBA4CONFIGURATION"
180 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
181 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=samba3"
182 export TORTURE4_OPTIONS
184 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
185 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:progress=no"
190 ## ready to go...now loop through the tests
195 # give time for nbt server to register its names
196 echo "delaying for nbt name registration"
198 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init
199 bin/nmblookup $CONFIGURATION -U $SERVER_IP __SAMBA__
200 bin/nmblookup $CONFIGURATION __SAMBA__
201 bin/nmblookup $CONFIGURATION -U 127.255.255.255 __SAMBA__
202 bin/nmblookup $CONFIGURATION -U $SERVER_IP $SERVER
203 bin/nmblookup $CONFIGURATION $SERVER
204 # make sure smbd is also up set
206 bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
207 bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
211 . $SCRIPTDIR/tests_$TESTS.sh
219 echo "START: $START ($0)";
220 echo "END: $END ($0)";
222 # if there were any valgrind failures, show them
223 count=`find $PREFIX -name 'valgrind.log*' | wc -l`
224 if [ "$count" != 0 ]; then
225 for f in $PREFIX/valgrind.log*; do
227 echo "VALGRIND FAILURE";
228 failed=`expr $failed + 1`
237 teststatus $0 $failed