diff options
Diffstat (limited to 'source3/script/tests')
-rwxr-xr-x | source3/script/tests/selftest.sh | 59 | ||||
-rw-r--r-- | source3/script/tests/test_functions.sh | 7 | ||||
-rwxr-xr-x | source3/script/tests/test_local_s3.sh | 2 | ||||
-rwxr-xr-x | source3/script/tests/test_net_misc.sh | 4 | ||||
-rwxr-xr-x | source3/script/tests/test_net_registry.sh | 9 | ||||
-rwxr-xr-x | source3/script/tests/test_net_s3.sh | 2 | ||||
-rwxr-xr-x | source3/script/tests/test_ntlm_auth_s3.sh | 2 | ||||
-rwxr-xr-x | source3/script/tests/test_posix_s3.sh | 2 | ||||
-rwxr-xr-x | source3/script/tests/test_smbclient_s3.sh | 45 | ||||
-rwxr-xr-x | source3/script/tests/test_smbtorture_s3.sh | 2 | ||||
-rwxr-xr-x | source3/script/tests/test_testparm_s3.sh | 2 | ||||
-rwxr-xr-x | source3/script/tests/test_wbinfo_s3.sh | 2 | ||||
-rwxr-xr-x | source3/script/tests/tests_all.sh | 4 | ||||
-rw-r--r-- | source3/script/tests/tests_smbclient_s3.sh | 2 |
14 files changed, 111 insertions, 33 deletions
diff --git a/source3/script/tests/selftest.sh b/source3/script/tests/selftest.sh index 94fd791b51..94621841f5 100755 --- a/source3/script/tests/selftest.sh +++ b/source3/script/tests/selftest.sh @@ -1,17 +1,44 @@ #!/bin/sh -if [ $# != 3 -a $# != 4 ]; then - echo "$0 <directory> <all | quick> <smbtorture4> [<shrdir>]" +if [ $# -lt 2 ]; then + echo "$0 <directory> <all | quick> [-t <smbtorture4>] [-s <shrdir>] " \ + "[-c <custom conf>]" exit 1 fi -SMBTORTURE4=$3 -SUBTESTS=$2 +## +## 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 $1 | sed s+//+/+` +PREFIX=`echo $DIRECTORY | sed s+//+/+` mkdir -p $PREFIX || exit $? OLD_PWD=`pwd` cd $PREFIX || exit $? @@ -68,7 +95,10 @@ export WINBINDD_SOCKET_DIR WINBINDD_PRIV_PIPE_DIR PATH=bin:$PATH export PATH -SAMBA4BINDIR=`dirname $SMBTORTURE4` +if [ $SMBTORTURE4 ]; then + SAMBA4BINDIR=`dirname $SMBTORTURE4` +fi + SAMBA4SHAREDDIR="$SAMBA4BINDIR/shared" export SAMBA4SHAREDDIR @@ -116,8 +146,8 @@ chmod 755 $WINBINDD_SOCKET_DIR ## ## Create an alternate shrdir if one was specified. ## -if [ $# = 4 ]; then - ALT_SHRDIR=`echo $4 | sed s+//+/+` +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 $? @@ -140,8 +170,6 @@ cat >$COMMONCONFFILE<<EOF private dir = $PRIVATEDIR pid directory = $PIDDIR lock directory = $LOCKDIR - state directory = $LOCKDIR - cache directory = $LOCKDIR log file = $LOGDIR/log.%m log level = 0 @@ -177,6 +205,9 @@ cat >$SERVERCONFFILE<<EOF panic action = $SCRIPTDIR/gdb_backtrace %d %\$(MAKE_TEST_BINARY) include = $COMMONCONFFILE + state directory = $LOCKDIR + cache directory = $LOCKDIR + passdb backend = tdbsam domain master = yes @@ -200,8 +231,6 @@ cat >$SERVERCONFFILE<<EOF # min receivefile size = 4000 -[tmp] - path = $SHRDIR read only = no smbd:sharedelay = 100000 smbd:writetimeupdatedelay = 500000 @@ -209,6 +238,12 @@ cat >$SERVERCONFFILE<<EOF map system = yes create mask = 755 vfs objects = $BINDIR/xattr_tdb.so $BINDIR/streams_depot.so + + #Include user defined custom parameters if set + $INCLUDE_CUSTOM_CONF + +[tmp] + path = $SHRDIR [hideunread] copy = tmp hide unreadable = yes diff --git a/source3/script/tests/test_functions.sh b/source3/script/tests/test_functions.sh index 407d46aa9e..bddae18c10 100644 --- a/source3/script/tests/test_functions.sh +++ b/source3/script/tests/test_functions.sh @@ -1,3 +1,4 @@ +TEST_FUNCTIONS_SH="INCLUDED" samba3_stop_sig_term() { RET=0 @@ -197,13 +198,13 @@ testit() { TEST_PCAP="$PREFIX/test_${shname}_${UNIQUE_PID}.pcap" trap "rm -f $TEST_LOG $TEST_PCAP" EXIT - if [ -z "$nmbd_log_size" ]; then + samba3_nmbd_test_log && if [ -z "$nmbd_log_size" ]; then nmbd_log_size=`wc -l < $NMBD_TEST_LOG`; fi - if [ -z "$winbindd_log_size" ]; then + samba3_winbindd_test_log && if [ -z "$winbindd_log_size" ]; then winbindd_log_size=`wc -l < $WINBINDD_TEST_LOG`; fi - if [ -z "$smbd_log_size" ]; then + samba3_smbd_test_log && if [ -z "$smbd_log_size" ]; then smbd_log_size=`wc -l < $SMBD_TEST_LOG`; fi diff --git a/source3/script/tests/test_local_s3.sh b/source3/script/tests/test_local_s3.sh index aed8637abd..1840779085 100755 --- a/source3/script/tests/test_local_s3.sh +++ b/source3/script/tests/test_local_s3.sh @@ -9,8 +9,10 @@ EOF exit 1; fi +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} failed=0 diff --git a/source3/script/tests/test_net_misc.sh b/source3/script/tests/test_net_misc.sh index 0a0636ac8a..8d092f4fe1 100755 --- a/source3/script/tests/test_net_misc.sh +++ b/source3/script/tests/test_net_misc.sh @@ -7,8 +7,10 @@ NET="$VALGRIND ${NET:-$BINDIR/net} $CONFIGURATION" NETTIME="${NET} time" NETLOOKUP="${NET} lookup" +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} failed=0 @@ -16,7 +18,7 @@ test_time() { PARAM="$1" - ${NETTIME} ${PARAM} -S localhost2 + ${NETTIME} -S ${SERVER} ${PARAM} } test_lookup() diff --git a/source3/script/tests/test_net_registry.sh b/source3/script/tests/test_net_registry.sh index 5edcb061ee..52a78bc339 100755 --- a/source3/script/tests/test_net_registry.sh +++ b/source3/script/tests/test_net_registry.sh @@ -13,8 +13,10 @@ else NETREG="${NET} registry" fi +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} failed=0 @@ -361,8 +363,11 @@ take_administrative_rights() if test "x${RPC}" = "xrpc" ; then testit "giving user ${USERNAME} administrative rights" \ - give_administrative_rights || \ - failed=`expr $failed + 1` + give_administrative_rights + if [ "x$?" != "x0" ] ; then + failed=`expr $failed + 1` + testok $0 $failed + fi fi testit "enumerate HKLM" \ diff --git a/source3/script/tests/test_net_s3.sh b/source3/script/tests/test_net_s3.sh index f7dc2b7e10..a0e83a65b1 100755 --- a/source3/script/tests/test_net_s3.sh +++ b/source3/script/tests/test_net_s3.sh @@ -2,8 +2,10 @@ # tests for the "net" command +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} failed=0 diff --git a/source3/script/tests/test_ntlm_auth_s3.sh b/source3/script/tests/test_ntlm_auth_s3.sh index 6c97f2e650..c7ebc03c80 100755 --- a/source3/script/tests/test_ntlm_auth_s3.sh +++ b/source3/script/tests/test_ntlm_auth_s3.sh @@ -1,7 +1,9 @@ #!/bin/sh +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} failed=0 diff --git a/source3/script/tests/test_posix_s3.sh b/source3/script/tests/test_posix_s3.sh index 3e9998666c..0885b139bb 100755 --- a/source3/script/tests/test_posix_s3.sh +++ b/source3/script/tests/test_posix_s3.sh @@ -16,8 +16,10 @@ start="$4" shift 4 ADDARGS="$*" +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} base="BASE-ATTR BASE-CHARSET BASE-CHKPATH BASE-DEFER_OPEN BASE-DELAYWRITE BASE-DELETE" base="$base BASE-DENY1 BASE-DENY2 BASE-DENY3 BASE-DENYDOS BASE-DIR1 BASE-DIR2" diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index c10aed0ee6..f60c7d7c0b 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -2,21 +2,25 @@ # this runs the file serving tests that are expected to pass with samba3 -if [ $# -lt 2 ]; then +if [ $# -lt 4 ]; then cat <<EOF -Usage: test_smbclient_s3.sh SERVER SERVER_IP +Usage: test_smbclient_s3.sh SERVER SERVER_IP USERNAME PASSWORD EOF exit 1; fi SERVER="$1" SERVER_IP="$2" +USERNAME="$3" +PASSWORD="$4" SMBCLIENT="$VALGRIND ${SMBCLIENT:-$BINDIR/smbclient} $CONFIGURATION" -shift 2 +shift 4 ADDARGS="$*" +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} failed=0 @@ -25,9 +29,18 @@ test_noninteractive_no_prompt() { prompt="smb" - echo du | \ - $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I SERVER_IP $ADDARGS 2>&1 | \ - grep $prompt + cmd='echo du | $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS 2>&1' + eval echo "$cmd" + out=`eval $cmd` + + if [ $? != 0 ] ; then + echo "$out" + echo "command failed" + false + return + fi + + echo "$out" | grep $prompt >/dev/null 2>&1 if [ $? = 0 ] ; then # got a prompt .. fail @@ -49,18 +62,26 @@ du quit EOF - CLI_FORCE_INTERACTIVE=yes \ - $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP \ - $ADDARGS < $tmpfile 2>/dev/null | \ - grep $prompt + cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT $CONFIGURATION "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS < $tmpfile 2>&1' + eval echo "$cmd" + out=`eval $cmd` + ret=$? + rm -f $tmpfile + + if [ $ret != 0 ] ; then + echo "$out" + echo "command failed" + false + return + fi + + echo "$out" | grep $prompt >/dev/null 2>&1 if [ $? = 0 ] ; then # got a prompt .. succeed - rm -f $tmpfile true else echo failed to match interactive prompt on stdout - rm -f $tmpfile false fi } diff --git a/source3/script/tests/test_smbtorture_s3.sh b/source3/script/tests/test_smbtorture_s3.sh index 2ec20dc6ac..842277b357 100755 --- a/source3/script/tests/test_smbtorture_s3.sh +++ b/source3/script/tests/test_smbtorture_s3.sh @@ -16,8 +16,10 @@ start="$4" shift 4 ADDARGS="$*" +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} tests="FDPASS LOCK1 LOCK2 LOCK3 LOCK4 LOCK5 LOCK6 LOCK7" #tests="$tests UNLINK BROWSE ATTR TRANS2 MAXFID TORTURE " diff --git a/source3/script/tests/test_testparm_s3.sh b/source3/script/tests/test_testparm_s3.sh index 6ea2794537..c88fc2d9d5 100755 --- a/source3/script/tests/test_testparm_s3.sh +++ b/source3/script/tests/test_testparm_s3.sh @@ -8,8 +8,10 @@ TEMP_CONFFILE=${LIBDIR}/smb.conf.tmp TESTPARM="$VALGRIND ${TESTPARM:-$BINDIR/testparm} --suppress-prompt --skip-logic-checks" +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} failed=0 diff --git a/source3/script/tests/test_wbinfo_s3.sh b/source3/script/tests/test_wbinfo_s3.sh index e3bf1b9e70..fa6e20fc72 100755 --- a/source3/script/tests/test_wbinfo_s3.sh +++ b/source3/script/tests/test_wbinfo_s3.sh @@ -14,8 +14,10 @@ password="$4" shift 4 ADDARGS="$*" +test x"$TEST_FUNCTIONS_SH" != x"INCLUDED" && { incdir=`dirname $0` . $incdir/test_functions.sh +} OLDIFS=$IFS; diff --git a/source3/script/tests/tests_all.sh b/source3/script/tests/tests_all.sh index 2b46da0e77..11d315b198 100755 --- a/source3/script/tests/tests_all.sh +++ b/source3/script/tests/tests_all.sh @@ -20,13 +20,13 @@ smbtorture_s3_encrypted() { smbclient_s3() { echo "RUNNING TESTS smbclient_s3" - $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP \ + $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD \ || failed=`expr $failed + $?` } smbclient_s3_encrypted() { echo "RUNNING TESTS smbclient_s3_encrypted" - $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP "-e" \ + $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD "-e" \ || failed=`expr $failed + $?` } diff --git a/source3/script/tests/tests_smbclient_s3.sh b/source3/script/tests/tests_smbclient_s3.sh index d48a692d4b..40edf2296f 100644 --- a/source3/script/tests/tests_smbclient_s3.sh +++ b/source3/script/tests/tests_smbclient_s3.sh @@ -1 +1 @@ -. $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP +. $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP $USERNAME $PASSWORD |