r7930: - added testing of the cifs passthru backend
[ira/wip.git] / source / script / tests / selftest.sh
1 #!/bin/sh
2 DOMAIN=SAMBADOMAIN
3 USERNAME=administrator
4 REALM=$DOMAIN
5 PASSWORD=penguin
6 SRCDIR=`pwd`
7 ROOT=$USER
8 if test -z "$ROOT"; then
9     ROOT=`whoami`
10 fi
11
12 if [ $# -lt 1 ]
13 then
14         echo "$0 PREFIX"
15         exit
16 fi
17
18 PREFIX=$1
19 export PREFIX
20 TMPDIR=$PREFIX/tmp
21 LIBDIR=$PREFIX/lib
22 PIDDIR=$PREFIX/pid
23 CONFFILE=$LIBDIR/smb.conf
24 PRIVATEDIR=$PREFIX/private
25 NCALRPCDIR=$PREFIX/ncalrpc
26 LOCKDIR=$PREFIX/lockdir
27 TLSDIR=$PRIVATEDIR/tls
28 CONFIGURATION="--configfile=$CONFFILE"
29 export CONFIGURATION
30
31 SMBD_TEST_FIFO="$PREFIX/smbd_test.fifo"
32 export SMBD_TEST_FIFO
33 SMBD_TEST_LOG="$PREFIX/smbd_test.log"
34 export SMBD_TEST_LOG
35
36 DO_SOCKET_WRAPPER=$2
37 if [ x"$DO_SOCKET_WRAPPER" = x"SOCKET_WRAPPER" ];then
38         SOCKET_WRAPPER_DIR="$PREFIX/socket_wrapper_dir"
39         export SOCKET_WRAPPER_DIR
40         echo "SOCKET_WRAPPER_DIR=$SOCKET_WRAPPER_DIR"
41 fi
42
43 # start off with 0 failures
44 failed=0
45 export failed
46
47 incdir=`dirname $0`
48 . $incdir/test_functions.sh
49
50 rm -rf $PREFIX/*
51 mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $NCALRPCDIR $LOCKDIR $TMPDIR $TLSDIR
52 ./setup/provision.pl --quiet --outputdir $PRIVATEDIR --domain $DOMAIN --realm $REALM \
53     --adminpass $PASSWORD --root=$ROOT
54
55 cat >$CONFFILE<<EOF
56 [global]
57         netbios name = LOCALHOST
58         workgroup = $DOMAIN
59         realm = $REALM
60         private dir = $PRIVATEDIR
61         pid directory = $PIDDIR
62         ncalrpc dir = $NCALRPCDIR
63         lock dir = $LOCKDIR
64         name resolve order = bcast
65         interfaces = lo*
66
67 [tmp]
68         path = $TMPDIR
69         read only = no
70         ntvfs handler = posix
71         posix:sharedelay = 100000
72         posix:eadb = $LOCKDIR/eadb.tdb
73
74 [cifs]
75         read only = no
76         ntvfs handler = cifs
77         cifs:server = localhost
78         cifs:user = $USERNAME
79         cifs:password = $PASSWORD
80         cifs:domain = $DOMAIN
81         cifs:share = tmp
82 EOF
83
84 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
85         CONFIGURATION="$CONFIGURATION --option=\"torture:progress=no\""
86 fi
87
88 smbd_check_or_start
89
90 # ensure any one smbtorture call doesn't run too long
91 TORTURE_OPTIONS="--maximum-runtime=300 $CONFIGURATION"
92 export TORTURE_OPTIONS
93
94
95 START=`date`
96 (
97  # give time for nbt server to register its names
98  echo delaying for nbt name registration
99  sleep 4
100  bin/nmblookup -U localhost localhost 
101
102  failed=0
103  $SRCDIR/script/tests/test_ldap.sh localhost $USERNAME $PASSWORD || failed=`expr $failed + $?`
104  $SRCDIR/script/tests/test_quick.sh //localhost/cifs $USERNAME $PASSWORD "" || failed=`expr $failed + $?`
105  $SRCDIR/script/tests/test_rpc.sh localhost $USERNAME $PASSWORD $DOMAIN || failed=`expr $failed + $?`
106  $SRCDIR/script/tests/test_session_key.sh localhost $USERNAME $PASSWORD $DOMAIN || failed=`expr $failed + $?`
107  $SRCDIR/script/tests/test_binding_string.sh localhost $USERNAME $PASSWORD $DOMAIN || failed=`expr $failed + $?`
108  $SRCDIR/script/tests/test_echo.sh localhost $USERNAME $PASSWORD $DOMAIN || failed=`expr $failed + $?`
109  $SRCDIR/script/tests/test_posix.sh //localhost/tmp $USERNAME $PASSWORD "" || failed=`expr $failed + $?`
110  $SRCDIR/script/tests/test_local.sh || failed=`expr $failed + $?`
111  exit $failed
112 ) 9>$SMBD_TEST_FIFO
113 failed=$?
114
115 END=`date`
116 echo "START: $START ($0)";
117 echo "END:   $END ($0)";
118
119 teststatus $0 $failed