#!/bin/sh if [ $# -lt 2 ]; then echo "$0 [-t ] [-s ] " \ "[-c ]" exit 1 fi ## ## Setup the required args ## DIRECTORY=$1; shift; SUBTESTS=$1; shift; ## ## Parse oprtional args ## while getopts s:c:t: f do case $f in t) SMBTORTURE4=$OPTARG;; s) ALT_SHRDIR_ARG=$OPTARG;; c) CUSTOM_CONF_ARG=$OPTARG;; esac done echo "Running selftest with the following" echo "Selftest Directory: $DIRECTORY" echo "Subtests to Run: $SUBTESTS" echo "smbtorture4 Path: $SMBTORTURE4" echo "Alternative Share Dir: $ALT_SHRDIR_ARG" echo "Custom Configuration: $CUSTOM_CONF_ARG" if [ $CUSTOM_CONF_ARG ]; then INCLUDE_CUSTOM_CONF="include = $CUSTOM_CONF_ARG" fi ## ## create the test directory ## PREFIX=`echo $DIRECTORY | sed s+//+/+` mkdir -p $PREFIX || exit $? OLD_PWD=`pwd` cd $PREFIX || exit $? PREFIX_ABS=`pwd` cd $OLD_PWD if [ -z "$TORTURE_MAXTIME" ]; then TORTURE_MAXTIME=300 fi export TORTURE_MAXTIME ## ## setup the various environment variables we need ## WORKGROUP=SAMBA-TEST SERVER=localhost2 SERVER_IP=127.0.0.2 if [ ! "x$USER" = "x" ]; then USERNAME=$USER else if [ ! "x$LOGNAME" = "x" ]; then USERNAME=$LOGNAME else USERNAME=`PATH=/usr/ucb:$PATH whoami || id -un` fi fi USERID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f1 | sed -e 's/uid=\([0-9]*\).*/\1/g'` GROUPID=`PATH=/usr/ucb:$PATH id | cut -d ' ' -f2 | sed -e 's/gid=\([0-9]*\).*/\1/g'` PASSWORD=test SRCDIR="`dirname $0`/../.." BINDIR="`pwd`/bin" SCRIPTDIR=$SRCDIR/script/tests LIBDIR=$PREFIX_ABS/lib PIDDIR=$PREFIX_ABS/pid CONFFILE=$LIBDIR/client.conf SAMBA4CONFFILE=$LIBDIR/samba4client.conf SERVERCONFFILE=$LIBDIR/server.conf COMMONCONFFILE=$LIBDIR/common.conf PRIVATEDIR=$PREFIX_ABS/private NCALRPCDIR=$PREFIX_ABS/ncalrpc LOCKDIR=$PREFIX_ABS/lockdir LOGDIR=$PREFIX_ABS/logs SOCKET_WRAPPER_DIR=$PREFIX_ABS/sw CONFIGURATION="--configfile $CONFFILE" SAMBA4CONFIGURATION="-s $SAMBA4CONFFILE" NSS_WRAPPER_PASSWD="$PRIVATEDIR/passwd" NSS_WRAPPER_GROUP="$PRIVATEDIR/group" WINBINDD_SOCKET_DIR=$PREFIX_ABS/winbindd WINBINDD_PRIV_PIPE_DIR=$LOCKDIR/winbindd_privileged TEST_DIRECTORY=$DIRECTORY export PREFIX PREFIX_ABS export CONFIGURATION CONFFILE SAMBA4CONFIGURATION SAMBA4CONFFILE export PATH SOCKET_WRAPPER_DIR DOMAIN export PRIVATEDIR LIBDIR PIDDIR LOCKDIR LOGDIR SERVERCONFFILE export SRCDIR SCRIPTDIR BINDIR export USERNAME PASSWORD export WORKGROUP SERVER SERVER_IP export NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR export TEST_DIRECTORY PATH=bin:$PATH export PATH if [ $SMBTORTURE4 ]; then SAMBA4BINDIR=`dirname $SMBTORTURE4` fi SAMBA4SHAREDDIR="$SAMBA4BINDIR/shared" export SAMBA4SHAREDDIR export SMBTORTURE4 if [ -z "$LIB_PATH_VAR" ] ; then echo "Warning: LIB_PATH_VAR not set. Using best guess LD_LIBRARY_PATH." >&2 LIB_PATH_VAR=LD_LIBRARY_PATH export LIB_PATH_VAR fi eval $LIB_PATH_VAR=$BINDIR:$SAMBA4SHAREDDIR:\$$LIB_PATH_VAR export $LIB_PATH_VAR ## ## verify that we were built with --enable-socket-wrapper ## if test "x`smbd -b | grep SOCKET_WRAPPER`" = "x"; then echo "***" echo "*** You must include --enable-socket-wrapper when compiling Samba" echo "*** in order to execute 'make test'. Exiting...." echo "***" exit 1 fi if test "x`smbd -b | grep NSS_WRAPPER`" = "x"; then echo "***" echo "*** You must include --enable-nss-wrapper when compiling Samba" echo "*** in order to execute 'make test'. Exiting...." echo "***" exit 1 fi ## ## create the test directory layout ## printf "%s" "CREATE TEST ENVIRONMENT IN '$PREFIX'"... /bin/rm -rf $PREFIX/* mkdir -p $PRIVATEDIR $NCALRPCDIR $LIBDIR $PIDDIR $LOCKDIR $LOGDIR mkdir -p $SOCKET_WRAPPER_DIR mkdir -p $WINBINDD_SOCKET_DIR chmod 755 $WINBINDD_SOCKET_DIR ## ## Create an alternate shrdir if one was specified. ## if [ $ALT_SHRDIR_ARG ]; then ALT_SHRDIR=`echo $ALT_SHRDIR_ARG | 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 ## cat >$COMMONCONFFILE<$CONFFILE<$SAMBA4CONFFILE<$SERVERCONFFILE<