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 name resolve order = bcast
101 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'
105 netbios name = TORTURE_6
106 interfaces = $TORTURE_INTERFACES
107 panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
108 include = $COMMONCONFFILE
110 passdb backend = tdbsam
113 cat >$SAMBA4CONFFILE<<EOF
115 netbios name = TORTURE_6
116 interfaces = $TORTURE_INTERFACES
117 panic action = $SCRIPTDIR/gdb_backtrace %PID% %PROG%
118 include = $COMMONCONFFILE
121 cat >$SERVERCONFFILE<<EOF
123 netbios name = $SERVER
124 interfaces = $SERVER_IP/8
125 bind interfaces only = yes
126 panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
127 include = $COMMONCONFFILE
129 passdb backend = tdbsam
131 ; Necessary to add the build farm hacks
132 add user script = /bin/false
133 add machine script = /bin/false
136 kernel change notify = no
140 printcap name = /dev/null
142 # min receivefile size = 4000
145 path = $PREFIX_ABS/tmp
147 smbd:sharedelay = 100000
153 hide unreadable = yes
156 hide unwriteable files = yes
170 ## create a test account
173 (echo $PASSWORD; echo $PASSWORD) | \
174 smbpasswd
-c $CONFFILE -L -s -a $USERNAME >/dev
/null ||
exit 1
178 SERVER_TEST_FIFO
="$PREFIX/server_test.fifo"
179 export SERVER_TEST_FIFO
180 NMBD_TEST_LOG
="$PREFIX/nmbd_test.log"
182 SMBD_TEST_LOG
="$PREFIX/smbd_test.log"
186 export MAKE_TEST_BINARY
188 # start off with 0 failures
192 .
$SCRIPTDIR/test_functions.sh
194 SOCKET_WRAPPER_DEFAULT_IFACE
=2
195 export SOCKET_WRAPPER_DEFAULT_IFACE
196 samba3_check_or_start
198 # ensure any one smbtorture call doesn't run too long
199 # and smbtorture will use 127.0.0.6 as source address by default
200 SOCKET_WRAPPER_DEFAULT_IFACE
=6
201 export SOCKET_WRAPPER_DEFAULT_IFACE
202 TORTURE4_OPTIONS
="$SAMBA4CONFIGURATION"
203 TORTURE4_OPTIONS
="$TORTURE4_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
204 TORTURE4_OPTIONS
="$TORTURE4_OPTIONS --target=samba3"
205 TORTURE4_OPTIONS
="$TORTURE4_OPTIONS --option=torture:localdir=$PREFIX_ABS/tmp"
206 export TORTURE4_OPTIONS
208 if [ x
"$RUN_FROM_BUILD_FARM" = x
"yes" ];then
209 TORTURE4_OPTIONS
="$TORTURE4_OPTIONS --option=torture:progress=no"
214 ## ready to go...now loop through the tests
219 # give time for nbt server to register its names
220 echo "delaying for nbt name registration"
222 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init
223 bin
/nmblookup
$CONFIGURATION -U $SERVER_IP __SAMBA__
224 bin
/nmblookup
$CONFIGURATION __SAMBA__
225 bin
/nmblookup
$CONFIGURATION -U 127.255.255.255 __SAMBA__
226 bin
/nmblookup
$CONFIGURATION -U $SERVER_IP $SERVER
227 bin
/nmblookup
$CONFIGURATION $SERVER
228 # make sure smbd is also up set
230 bin
/smbclient
$CONFIGURATION -L $SERVER_IP -U% -p 139 |
head -2
231 bin
/smbclient
$CONFIGURATION -L $SERVER_IP -U% -p 139 |
head -2
235 .
$SCRIPTDIR/tests_
$TESTS.sh
243 echo "START: $START ($0)";
244 echo "END: $END ($0)";
246 # if there were any valgrind failures, show them
247 count
=`find $PREFIX -name 'valgrind.log*' | wc -l`
248 if [ "$count" != 0 ]; then
249 for f
in $PREFIX/valgrind.log
*; do
251 echo "VALGRIND FAILURE";
252 failed
=`expr $failed + 1`
261 teststatus
$0 $failed