3 if [ $# != 3 -a $# != 4 ]; then
4 echo "$0 <directory> <all | quick> <smbtorture4> [<shrdir>]"
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
33 USERNAME
=`PATH=/usr/ucb:$PATH whoami`
34 USERID
=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f1 | sed -e 's/uid=\([0-9]*\).*/\1/g'`
35 GROUPID
=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f2 | sed -e 's/gid=\([0-9]*\).*/\1/g'`
38 SRCDIR
="`dirname $0`/../.."
40 SCRIPTDIR
=$SRCDIR/script
/tests
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
="--configfile $CONFFILE"
52 SAMBA4CONFIGURATION
="-s $SAMBA4CONFFILE"
53 NSS_WRAPPER_PASSWD
="$PRIVATEDIR/passwd"
54 NSS_WRAPPER_GROUP
="$PRIVATEDIR/group"
55 WINBINDD_SOCKET_DIR
=$PREFIX_ABS/winbindd
56 WINBINDD_PRIV_PIPE_DIR
=$LOCKDIR/winbindd_privileged
58 export PREFIX PREFIX_ABS
59 export CONFIGURATION CONFFILE SAMBA4CONFIGURATION SAMBA4CONFFILE
60 export PATH SOCKET_WRAPPER_DIR DOMAIN
61 export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE
62 export SRCDIR SCRIPTDIR BINDIR
63 export USERNAME PASSWORD
64 export WORKGROUP SERVER SERVER_IP
65 export NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
66 export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR
71 SAMBA4BINDIR
=`dirname $SMBTORTURE4`
72 SAMBA4SHAREDDIR
="$SAMBA4BINDIR/shared"
74 export SAMBA4SHAREDDIR
77 if test x
"$LD_LIBRARY_PATH" != x
""; then
78 LD_LIBRARY_PATH
="$BINDIR:$SAMBA4SHAREDDIR:$LD_LIBRARY_PATH"
80 LD_LIBRARY_PATH
="$BINDIR:$SAMBA4SHAREDDIR"
82 echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH"
83 export LD_LIBRARY_PATH
86 ## verify that we were built with --enable-socket-wrapper
89 if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then
91 echo "*** You must include --enable-socket-wrapper when compiling Samba"
92 echo "*** in order to execute 'make test'. Exiting...."
97 if test "x`smbd -b | grep NSS_WRAPPER`" = "x"; then
99 echo "*** You must include --enable-nss-wrapper when compiling Samba"
100 echo "*** in order to execute 'make test'. Exiting...."
107 ## create the test directory layout
109 printf "%s" "CREATE TEST ENVIRONMENT IN '$PREFIX'"...
110 /bin
/rm -rf $PREFIX/*
111 mkdir
-p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR
112 mkdir
-p $SOCKET_WRAPPER_DIR
113 mkdir
-p $WINBINDD_SOCKET_DIR
114 chmod 755 $WINBINDD_SOCKET_DIR
117 ## Create an alternate shrdir if one was specified.
120 ALT_SHRDIR
=`echo $4 | sed s+//+/+`
121 mkdir
-p $ALT_SHRDIR ||
exit $?
123 cd $ALT_SHRDIR ||
exit $?
126 /bin
/rm -rf $SHRDIR/*
128 SHRDIR
=$PREFIX_ABS/tmp
134 ## Create the common config include file with the basic settings
137 cat >$COMMONCONFFILE<<EOF
138 workgroup = $WORKGROUP
140 private dir = $PRIVATEDIR
141 pid directory = $PIDDIR
142 lock directory = $LOCKDIR
143 log file = $LOGDIR/log.%m
146 name resolve order = bcast
149 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'
153 netbios name = TORTURE_6
154 interfaces = $TORTURE_INTERFACES
155 panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
156 include = $COMMONCONFFILE
158 passdb backend = tdbsam
161 cat >$SAMBA4CONFFILE<<EOF
163 netbios name = TORTURE_6
164 interfaces = $TORTURE_INTERFACES
165 panic action = $SCRIPTDIR/gdb_backtrace %PID% %PROG%
166 include = $COMMONCONFFILE
169 cat >$SERVERCONFFILE<<EOF
171 netbios name = $SERVER
172 interfaces = $SERVER_IP/8
173 bind interfaces only = yes
174 panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY)
175 include = $COMMONCONFFILE
177 passdb backend = tdbsam
183 add user script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
184 add machine script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
185 delete user script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action delete --name %u
188 kernel change notify = no
192 printcap name = /dev/null
194 winbindd:socket dir = $WINBINDD_SOCKET_DIR
195 idmap uid = 100000-200000
196 idmap gid = 100000-200000
198 # min receivefile size = 4000
203 smbd:sharedelay = 100000
204 smbd:writetimeupdatedelay = 500000
208 vfs objects = $BINDIR/xattr_tdb.so $BINDIR/streams_depot.so
211 hide unreadable = yes
214 hide unwriteable files = yes
228 ## create a test account
231 cat >$NSS_WRAPPER_PASSWD<<EOF
232 nobody:x:65534:65533:nobody gecos:$PREFIX_ABS:/bin/false
233 $USERNAME:x:$USERID:$GROUPID:$USERNAME gecos:$PREFIX_ABS:/bin/false
236 cat >$NSS_WRAPPER_GROUP<<EOF
238 nogroup:x:65534:nobody
239 $USERNAME-group:x:$GROUPID:
242 MAKE_TEST_BINARY
="bin/smbpasswd"
243 export MAKE_TEST_BINARY
245 (echo $PASSWORD; echo $PASSWORD) | \
246 bin
/smbpasswd
-c $CONFFILE -L -s -a $USERNAME >/dev
/null ||
exit 1
252 SERVER_TEST_FIFO
="$PREFIX/server_test.fifo"
253 export SERVER_TEST_FIFO
254 NMBD_TEST_LOG
="$PREFIX/nmbd_test.log"
256 WINBINDD_TEST_LOG
="$PREFIX/winbindd_test.log"
257 export WINBINDD_TEST_LOG
258 SMBD_TEST_LOG
="$PREFIX/smbd_test.log"
261 # start off with 0 failures
265 .
$SCRIPTDIR/test_functions.sh
267 SOCKET_WRAPPER_DEFAULT_IFACE
=2
268 export SOCKET_WRAPPER_DEFAULT_IFACE
269 samba3_check_or_start
272 # ensure any one smbtorture call doesn't run too long
273 # and smbtorture will use 127.0.0.6 as source address by default
274 SOCKET_WRAPPER_DEFAULT_IFACE
=6
275 export SOCKET_WRAPPER_DEFAULT_IFACE
276 TORTURE4_OPTIONS
="$SAMBA4CONFIGURATION"
277 TORTURE4_OPTIONS
="$TORTURE4_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
278 TORTURE4_OPTIONS
="$TORTURE4_OPTIONS --target=samba3"
279 TORTURE4_OPTIONS
="$TORTURE4_OPTIONS --option=torture:localdir=$SHRDIR"
280 export TORTURE4_OPTIONS
282 if [ x
"$RUN_FROM_BUILD_FARM" = x
"yes" ];then
283 TORTURE4_OPTIONS
="$TORTURE4_OPTIONS --option=torture:progress=no"
288 ## ready to go...now loop through the tests
293 # give time for nbt server to register its names
294 echo "delaying for nbt name registration"
296 # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init
297 MAKE_TEST_BINARY
="bin/nmblookup"
298 bin
/nmblookup
$CONFIGURATION -U $SERVER_IP __SAMBA__
299 bin
/nmblookup
$CONFIGURATION __SAMBA__
300 bin
/nmblookup
$CONFIGURATION -U 127.255.255.255 __SAMBA__
301 bin
/nmblookup
$CONFIGURATION -U $SERVER_IP $SERVER
302 bin
/nmblookup
$CONFIGURATION $SERVER
303 # make sure smbd is also up set
305 MAKE_TEST_BINARY
="bin/smbclient"
306 bin
/smbclient
$CONFIGURATION -L $SERVER_IP -U% -p 139 |
head -2
307 bin
/smbclient
$CONFIGURATION -L $SERVER_IP -U% -p 139 |
head -2
312 .
$SCRIPTDIR/tests_
$SUBTESTS.sh
320 echo "START: $START ($0)";
321 echo "END: $END ($0)";
323 # if there were any valgrind failures, show them
324 count
=`find $PREFIX -name 'valgrind.log*' | wc -l`
325 if [ "$count" != 0 ]; then
326 for f
in $PREFIX/valgrind.log
*; do
328 echo "VALGRIND FAILURE";
329 failed
=`expr $failed + 1`
338 teststatus
$0 $failed