summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-29 10:29:35 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-29 10:36:12 +0100
commit77bb2d6d0b6ba994aa5f9295ed42b1dbf98898b6 (patch)
tree9b41c73610c9ac0b0420e5bc5864f9ffbdbfc25c /source3
parent67bf7a2396051d10c07aeaa2d8b373a96a44d892 (diff)
downloadsamba-77bb2d6d0b6ba994aa5f9295ed42b1dbf98898b6.tar.gz
samba-77bb2d6d0b6ba994aa5f9295ed42b1dbf98898b6.tar.bz2
samba-77bb2d6d0b6ba994aa5f9295ed42b1dbf98898b6.zip
s3:seltest: make test_smbclient_s3.sh more strict
metze
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh43
-rwxr-xr-xsource3/script/tests/tests_all.sh4
-rw-r--r--source3/script/tests/tests_smbclient_s3.sh2
-rwxr-xr-xsource3/selftest/tests.sh2
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