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`
33 USERID=`PATH=/usr/ucb:$PATH id -u`
34 GROUPID=`PATH=/usr/ucb:$PATH id -g`
37 SRCDIR="`dirname $0`/../.."
39 SCRIPTDIR=$SRCDIR/script/tests
40 SHRDIR=$PREFIX_ABS/tmp
41 LIBDIR=$PREFIX_ABS/lib
42 PIDDIR=$PREFIX_ABS/pid
43 CONFFILE=$LIBDIR/client.conf
44 SAMBA4CONFFILE=$LIBDIR/samba4client.conf
45 SERVERCONFFILE=$LIBDIR/server.conf
46 COMMONCONFFILE=$LIBDIR/common.conf
47 PRIVATEDIR=$PREFIX_ABS/private
48 LOCKDIR=$PREFIX_ABS/lockdir
49 LOGDIR=$PREFIX_ABS/logs
50 SOCKET_WRAPPER_DIR=$PREFIX/sw
51 CONFIGURATION="-s $CONFFILE"
52 SAMBA4CONFIGURATION="-s $SAMBA4CONFFILE"
53 NSS_WRAPPER_PASSWD="$PRIVATEDIR/passwd"
54 NSS_WRAPPER_GROUP="$PRIVATEDIR/group"
56 export PREFIX PREFIX_ABS
57 export CONFIGURATION CONFFILE SAMBA4CONFIGURATION SAMBA4CONFFILE
58 export PATH SOCKET_WRAPPER_DIR DOMAIN
59 export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE
60 export SRCDIR SCRIPTDIR BINDIR
61 export USERNAME PASSWORD
63 export SERVER SERVER_IP
64 export NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
70 ## verify that we were built with --enable-socket-wrapper
73 if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then
75 echo "*** You must include --enable-socket-wrapper when compiling Samba"
76 echo "*** in order to execute 'make test'. Exiting...."
81 if test "x`smbd -b | grep NSS_WRAPPER`" = "x"; then
83 echo "*** You must include --enable-nss-wrapper when compiling Samba"
84 echo "*** in order to execute 'make test'. Exiting...."
91 ## create the test directory layout
93 echo -n "CREATE TEST ENVIRONMENT IN '$PREFIX'"...
95 mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR $SOCKET_WRAPPER_DIR
96 mkdir -p $PREFIX_ABS/tmp
97 chmod 777 $PREFIX_ABS/tmp
100 ## Create the common config include file with the basic settings
103 cat >$COMMONCONFFILE<<EOF
104 workgroup = SAMBA-TEST
106 private dir = $PRIVATEDIR
107 pid directory = $PIDDIR
108 lock directory = $LOCKDIR
109 log file = $LOGDIR/log.%m
112 name resolve order = bcast
115 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'
119 netbios name = TORTURE_6
120 interfaces = $TORTURE_INTERFACES
121 panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
122 include = $COMMONCONFFILE
124 passdb backend = tdbsam
127 cat >$SAMBA4CONFFILE<<EOF
129 netbios name = TORTURE_6
130 interfaces = $TORTURE_INTERFACES
131 panic action = $SCRIPTDIR/gdb_backtrace %PID% %PROG%
132 include = $COMMONCONFFILE
135 cat >$SERVERCONFFILE<<EOF
137 netbios name = $SERVER
138 interfaces = $SERVER_IP/8
139 bind interfaces only = yes
140 panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
141 include = $COMMONCONFFILE
143 passdb backend = tdbsam
145 add user script = $PERL $SRCDIR/lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
146 add machine script = $PERL $SRCDIR/lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
147 delete user script = $PERL $SRCDIR/lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action delete --name %u
150 kernel change notify = no
154 printcap name = /dev/null
156 # min receivefile size = 4000
159 path = $PREFIX_ABS/tmp
161 smbd:sharedelay = 100000
167 hide unreadable = yes
170 hide unwriteable files = yes
184 ## create a test account
187 cat >$NSS_WRAPPER_PASSWD<<EOF
188 nobody:x:65534:65533:nobody gecos:$PREFIX_ABS:/bin/false
189 $USERNAME:x:$USERID:$GROUPID:$USERNAME gecos:$PREFIX_ABS:/bin/false
192 cat >$NSS_WRAPPER_GROUP<<EOF
194 nogroup:x:65534:nobody
195 $USERNAME-group:x:$GROUPID:
198 (echo $PASSWORD; echo $PASSWORD) | \
199 smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1
203 SERVER_TEST_FIFO="$PREFIX/server_test.fifo"
204 export SERVER_TEST_FIFO
205 NMBD_TEST_LOG="$PREFIX/nmbd_test.log"
207 SMBD_TEST_LOG="$PREFIX/smbd_test.log"
211 export MAKE_TEST_BINARY
213 # start off with 0 failures
217 . $SCRIPTDIR/test_functions.sh
219 SOCKET_WRAPPER_DEFAULT_IFACE=2
220 export SOCKET_WRAPPER_DEFAULT_IFACE
221 samba3_check_or_start
223 # ensure any one smbtorture call doesn't run too long
224 # and smbtorture will use 127.0.0.6 as source address by default
225 SOCKET_WRAPPER_DEFAULT_IFACE=6
226 export SOCKET_WRAPPER_DEFAULT_IFACE
227 TORTURE4_OPTIONS="$SAMBA4CONFIGURATION"
228 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
229 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=samba3"
230 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$PREFIX_ABS/tmp"
231 export TORTURE4_OPTIONS
233 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
234 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:progress=no"
239 ## ready to go...now loop through the tests
244 # give time for nbt server to register its names
245 echo "delaying for nbt name registration"
247 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init
248 bin/nmblookup $CONFIGURATION -U $SERVER_IP __SAMBA__
249 bin/nmblookup $CONFIGURATION __SAMBA__
250 bin/nmblookup $CONFIGURATION -U 127.255.255.255 __SAMBA__
251 bin/nmblookup $CONFIGURATION -U $SERVER_IP $SERVER
252 bin/nmblookup $CONFIGURATION $SERVER
253 # make sure smbd is also up set
255 bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
256 bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
260 . $SCRIPTDIR/tests_$TESTS.sh
268 echo "START: $START ($0)";
269 echo "END: $END ($0)";
271 # if there were any valgrind failures, show them
272 count=`find $PREFIX -name 'valgrind.log*' | wc -l`
273 if [ "$count" != 0 ]; then
274 for f in $PREFIX/valgrind.log*; do
276 echo "VALGRIND FAILURE";
277 failed=`expr $failed + 1`
286 teststatus $0 $failed