s3:selftest: test the streams_depot module as it passes make test
[kai/samba.git] / source3 / script / tests / selftest.sh
index 86abb15ed1dcc3f9559e04d2cffc44827d379767..3b65aaa7602b00155529ee2fa2427b346c9c9ad2 100755 (executable)
@@ -1,12 +1,12 @@
 #!/bin/sh
 
-if [ $# != 3 ]; then
-       echo "$0 <directory> <all | quick> <smbtorture4>"
+if [ $# != 3 -a $# != 4 ]; then
+       echo "$0 <directory> <all | quick> <smbtorture4> [<shrdir>]"
        exit 1
 fi
 
 SMBTORTURE4=$3
-TESTS=$2
+SUBTESTS=$2
 
 ##
 ## create the test directory
@@ -38,7 +38,6 @@ PASSWORD=test
 SRCDIR="`dirname $0`/../.."
 BINDIR="`pwd`/bin"
 SCRIPTDIR=$SRCDIR/script/tests
-SHRDIR=$PREFIX_ABS/tmp
 LIBDIR=$PREFIX_ABS/lib
 PIDDIR=$PREFIX_ABS/pid
 CONFFILE=$LIBDIR/client.conf
@@ -107,14 +106,29 @@ fi
 ## 
 ## create the test directory layout
 ##
-echo -n "CREATE TEST ENVIRONMENT IN '$PREFIX'"...
+printf "%s" "CREATE TEST ENVIRONMENT IN '$PREFIX'"...
 /bin/rm -rf $PREFIX/*
 mkdir -p $PRIVATEDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR
 mkdir -p $SOCKET_WRAPPER_DIR
 mkdir -p $WINBINDD_SOCKET_DIR
 chmod 755 $WINBINDD_SOCKET_DIR
-mkdir -p $PREFIX_ABS/tmp
-chmod 777 $PREFIX_ABS/tmp
+
+##
+## Create an alternate shrdir if one was specified.
+##
+if [ $# = 4 ]; then
+    ALT_SHRDIR=`echo $4 | sed s+//+/+`
+    mkdir -p $ALT_SHRDIR || exit $?
+    OLD_PWD=`pwd`
+    cd $ALT_SHRDIR || exit $?
+    SHRDIR=`pwd`
+    cd $OLD_PWD
+    /bin/rm -rf $SHRDIR/*
+else
+    SHRDIR=$PREFIX_ABS/tmp
+    mkdir -p $SHRDIR
+fi
+chmod 777 $SHRDIR
 
 ##
 ## Create the common config include file with the basic settings
@@ -162,9 +176,13 @@ cat >$SERVERCONFFILE<<EOF
 
        passdb backend = tdbsam
 
-       add user script = $PERL $SRCDIR/lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
-       add machine script = $PERL $SRCDIR/lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
-       delete user script = $PERL $SRCDIR/lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action delete --name %u
+       domain master = yes
+       domain logons = yes
+       time server = yes
+
+       add user script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
+       add machine script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action add --name %u
+       delete user script = $PERL $SRCDIR/../lib/nss_wrapper/nss_wrapper.pl --path $NSS_WRAPPER_PASSWD --type passwd --action delete --name %u
 
        kernel oplocks = no
        kernel change notify = no
@@ -180,12 +198,14 @@ cat >$SERVERCONFFILE<<EOF
 #      min receivefile size = 4000
 
 [tmp]
-       path = $PREFIX_ABS/tmp
+       path = $SHRDIR
        read only = no
        smbd:sharedelay = 100000
+       smbd:writetimeupdatedelay = 500000
        map hidden = yes
        map system = yes
        create mask = 755
+       vfs objects = $BINDIR/xattr_tdb.so $BINDIR/streams_depot.so
 [hideunread]
        copy = tmp
        hide unreadable = yes
@@ -219,11 +239,16 @@ nogroup:x:65534:nobody
 $USERNAME-group:x:$GROUPID:
 EOF
 
+MAKE_TEST_BINARY="bin/smbpasswd"
+export MAKE_TEST_BINARY
+
 (echo $PASSWORD; echo $PASSWORD) | \
-       smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1
+       bin/smbpasswd -c $CONFFILE -L -s -a $USERNAME >/dev/null || exit 1
 
 echo "DONE";
 
+MAKE_TEST_BINARY=""
+
 SERVER_TEST_FIFO="$PREFIX/server_test.fifo"
 export SERVER_TEST_FIFO
 NMBD_TEST_LOG="$PREFIX/nmbd_test.log"
@@ -233,9 +258,6 @@ export WINBINDD_TEST_LOG
 SMBD_TEST_LOG="$PREFIX/smbd_test.log"
 export SMBD_TEST_LOG
 
-MAKE_TEST_BINARY=""
-export MAKE_TEST_BINARY
-
 # start off with 0 failures
 failed=0
 export failed
@@ -246,6 +268,7 @@ SOCKET_WRAPPER_DEFAULT_IFACE=2
 export SOCKET_WRAPPER_DEFAULT_IFACE
 samba3_check_or_start
 
+
 # ensure any one smbtorture call doesn't run too long
 # and smbtorture will use 127.0.0.6 as source address by default
 SOCKET_WRAPPER_DEFAULT_IFACE=6
@@ -253,7 +276,7 @@ export SOCKET_WRAPPER_DEFAULT_IFACE
 TORTURE4_OPTIONS="$SAMBA4CONFIGURATION"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --maximum-runtime=$TORTURE_MAXTIME"
 TORTURE4_OPTIONS="$TORTURE4_OPTIONS --target=samba3"
-TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$PREFIX_ABS/tmp"
+TORTURE4_OPTIONS="$TORTURE4_OPTIONS --option=torture:localdir=$SHRDIR"
 export TORTURE4_OPTIONS
 
 if [ x"$RUN_FROM_BUILD_FARM" = x"yes" ];then
@@ -271,6 +294,7 @@ START=`date`
  echo "delaying for nbt name registration"
  sleep 10
  # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init 
+ MAKE_TEST_BINARY="bin/nmblookup"
  bin/nmblookup $CONFIGURATION -U $SERVER_IP __SAMBA__
  bin/nmblookup $CONFIGURATION __SAMBA__
  bin/nmblookup $CONFIGURATION -U 127.255.255.255 __SAMBA__
@@ -278,12 +302,14 @@ START=`date`
  bin/nmblookup $CONFIGURATION $SERVER
  # make sure smbd is also up set
  echo "wait for smbd"
+ MAKE_TEST_BINARY="bin/smbclient"
  bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
  bin/smbclient $CONFIGURATION -L $SERVER_IP -U% -p 139 | head -2
+ MAKE_TEST_BINARY=""
 
  failed=0
 
- . $SCRIPTDIR/tests_$TESTS.sh
+ . $SCRIPTDIR/tests_$SUBTESTS.sh
  exit $failed
 )
 failed=$?