2 # Bootstrap Samba and run a number of tests against it.
6 REALM
=SAMBA.EXAMPLE.COM
11 if test -z "$ROOT"; then
14 if test -z "$ROOT"; then
24 if [ -z "$TORTURE_MAXTIME" ]; then
30 PREFIX
=`echo $PREFIX | sed s+//+/+`
33 # allow selection of the test lists
36 if [ $TESTS = "all" ]; then
42 mkdir
-p $PREFIX ||
exit $?
49 TEST_DATA_PREFIX
=$PREFIX_ABS
50 export TEST_DATA_PREFIX
52 TMPDIR
=$PREFIX_ABS/tmp
53 LIBDIR
=$PREFIX_ABS/lib
54 ETCDIR
=$PREFIX_ABS/etc
55 PIDDIR
=$PREFIX_ABS/pid
56 CONFFILE
=$ETCDIR/smb.conf
57 KRB5_CONFIG
=$ETCDIR/krb5.conf
58 PRIVATEDIR
=$PREFIX_ABS/private
59 NCALRPCDIR
=$PREFIX_ABS/ncalrpc
60 LOCKDIR
=$PREFIX_ABS/lockdir
61 TLSDIR
=$PRIVATEDIR/tls
62 CONFIGURATION
="--configfile=$CONFFILE"
66 SMBD_TEST_FIFO
="$PREFIX/smbd_test.fifo"
68 SMBD_TEST_LOG
="$PREFIX/smbd_test.log"
72 if [ x
"$DO_SOCKET_WRAPPER" = x
"SOCKET_WRAPPER" ];then
73 SOCKET_WRAPPER_DIR
="$PREFIX/sw"
74 export SOCKET_WRAPPER_DIR
75 echo "SOCKET_WRAPPER_DIR=$SOCKET_WRAPPER_DIR"
78 # start off with 0 failures
83 .
$incdir/test_functions.sh
89 mkdir
-p $PRIVATEDIR $ETCDIR $LIBDIR $PIDDIR $NCALRPCDIR $LOCKDIR $TMPDIR $TLSDIR
91 cat >$PRIVATEDIR/wins_config.ldif
<<EOF
92 dn: name=TORTURE_26,CN=PARTNERS
93 objectClass: wreplPartner
103 netbios name = $SERVER
106 private dir = $PRIVATEDIR
107 pid directory = $PIDDIR
108 ncalrpc dir = $NCALRPCDIR
110 setup directory = $SRCDIR/setup
111 js include = $SRCDIR/scripting/libjs
112 name resolve order = bcast
113 interfaces = 127.0.0.1/8
114 tls enabled = $TLS_ENABLED
115 panic action = $SRCDIR/script/gdb_backtrace %PID% %PROG%
122 ntvfs handler = posix
123 posix:sharedelay = 100000
124 posix:eadb = $LOCKDIR/eadb.tdb
129 cifs:server = $SERVER
130 cifs:user = $USERNAME
131 cifs:password = $PASSWORD
132 cifs:domain = $DOMAIN
136 cat >$KRB5_CONFIG<<EOF
138 default_realm = SAMBA.EXAMPLE.COM
139 dns_lookup_realm = false
140 dns_lookup_kdc = false
141 ticket_lifetime = 24h
145 SAMBA.EXAMPLE.COM = {
147 admin_server = 127.0.0.1
148 default_domain = samba.example.com
151 .samba.example.com = SAMBA.EXAMPLE.COM
156 echo -n "PROVISIONING..."
158 .
/setup
/provision
$CONFIGURATION --host-name=$SERVER --host-ip=127.0.0.1 \
159 --quiet --domain $DOMAIN --realm $REALM \
160 --adminpass $PASSWORD --root=$ROOT ||
exit 1
162 .
/bin
/ldbadd
-H $PRIVATEDIR/wins_config.ldb
< $PRIVATEDIR/wins_config.ldif
>/dev
/null ||
exit 1
166 if [ x
"$RUN_FROM_BUILD_FARM" = x
"yes" ];then
167 CONFIGURATION
="$CONFIGURATION --option=\"torture:progress=no\""
170 SOCKET_WRAPPER_DEFAULT_IFACE
=1
171 export SOCKET_WRAPPER_DEFAULT_IFACE
174 # ensure any one smbtorture call doesn't run too long
175 SOCKET_WRAPPER_DEFAULT_IFACE
=26
176 export SOCKET_WRAPPER_DEFAULT_IFACE
177 TORTURE_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'
178 TORTURE_OPTIONS
="--maximum-runtime=$TORTURE_MAXTIME --option=interfaces=$TORTURE_INTERFACES $CONFIGURATION"
179 export TORTURE_OPTIONS
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 $SERVER
188 bin
/nmblookup
$CONFIGURATION -U $SERVER $SERVER
189 bin
/nmblookup
$CONFIGURATION -U $SERVER $SERVER
193 . script
/tests
/tests_
$TESTS.sh
198 kill `cat $PIDDIR/smbd.pid`
201 echo "START: $START ($0)";
202 echo "END: $END ($0)";
204 # if there were any valgrind failures, show them
205 count
=`find $PREFIX -name 'valgrind.log*' | wc -l`
206 if [ "$count" != 0 ]; then
207 for f
in $PREFIX/valgrind.log
*; do
209 echo "VALGRIND FAILURE";
210 failed
=`expr $failed + 1`
216 teststatus
$0 $failed