diff options
-rwxr-xr-x | source3/script/tests/test_smbclient_s3.sh | 43 | ||||
-rwxr-xr-x | source3/script/tests/tests_all.sh | 4 | ||||
-rw-r--r-- | source3/script/tests/tests_smbclient_s3.sh | 2 | ||||
-rwxr-xr-x | source3/selftest/tests.sh | 2 |
4 files changed, 35 insertions, 16 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index c10aed0ee6..1d55087c88 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -2,17 +2,19 @@ # 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="$*" incdir=`dirname $0` @@ -25,9 +27,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 +60,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/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 diff --git a/source3/selftest/tests.sh b/source3/selftest/tests.sh index 98568b6bb3..3a53fa1df2 100755 --- a/source3/selftest/tests.sh +++ b/source3/selftest/tests.sh @@ -65,6 +65,6 @@ for t in $tests; do plantest "$name" dc $VALGRIND $BINDIR/smbtorture //\$SERVER/tmp -U\$USERNAME%\$PASSWORD $t done -plantest "blackbox.smbclient" dc BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP +plantest "blackbox.smbclient" dc BINDIR="$BINDIR" script/tests/test_smbclient_s3.sh \$SERVER \$SERVER_IP \$USERNAME \$PASSWORD plantest "blackbox.wbinfo" dc BINDIR="$BINDIR" script/tests/test_wbinfo_s3.sh \$DOMAIN \$SERVER \$USERNAME \$PASSWORD plantest "blackbox.net" dc BINDIR="$BINDIR" SCRIPTDIR="$SCRIPTDIR" script/tests/test_net_s3.sh |