summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJames Peach <jpeach@samba.org>2006-06-15 23:47:41 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:17:30 -0500
commitae2fb4f1093e28e4656371b9bbeb229fd1ed1ada (patch)
tree147a97bc572216852a6dbeb367e9d40fee846381 /source3
parentd4ad11ccd8dd6780e048849784b33fd55d5a04b6 (diff)
downloadsamba-ae2fb4f1093e28e4656371b9bbeb229fd1ed1ada.tar.gz
samba-ae2fb4f1093e28e4656371b9bbeb229fd1ed1ada.tar.bz2
samba-ae2fb4f1093e28e4656371b9bbeb229fd1ed1ada.zip
r16273: Add smbclient tests to verify that
in interactive mode, smbclient always prompts on stdout in non-interactive mode, smbclient never prompts (This used to be commit dff1eba81ed4bdd6dbf2df6e7c28b0da74a39615)
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh58
-rw-r--r--source3/script/tests/tests_smbclient_s3.sh1
2 files changed, 57 insertions, 2 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 007f3839f7..98b165e735 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -11,13 +11,67 @@ fi
SERVER="$1"
SERVER_IP="$2"
+SMBCLIENT="$VALGRIND ${SMBCLIENT:-$SRCDIR/bin/smbclient} $CONFIGURATION"
incdir=`dirname $0`
. $incdir/test_functions.sh
failed=0
-testit "smbclient -L $SERVER_IP" $VALGRIND $SRCDIR/bin/smbclient $CONFIGURATION -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
-testit "smbclient -L $SERVER" $VALGRIND $SRCDIR/bin/smbclient $CONFIGURATION -L $SERVER -N -p 139 || failed=`expr $failed + 1`
+# Test that a noninteractive smbclient does not prompt
+test_noninteractive_no_prompt()
+{
+ prompt="smb"
+
+ echo du | \
+ $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp 2>&1 | \
+ grep $prompt
+
+ if [ $? = 0 ] ; then
+ # got a prompt .. fail
+ echo matched interactive prompt in non-interactive mode
+ false
+ else
+ true
+ fi
+}
+
+# Test that an interactive smbclient prompts to stdout
+test_interactive_prompt_stdout()
+{
+ prompt="smb"
+
+ echo du | \
+ CLI_FORCE_INTERACTIVE=yes \
+ $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp 2>/dev/null | \
+ grep $prompt
+
+ if [ $? = 0 ] ; then
+ # got a prompt .. succeed
+ true
+ else
+ echo failed to match interactive prompt on stdout
+ false
+ fi
+}
+
+testit "smbclient -L $SERVER_IP" $SMBCLIENT -L $SERVER_IP -N -p 139 || failed=`expr $failed + 1`
+testit "smbclient -L $SERVER" $SMBCLIENT -L $SERVER -N -p 139 || failed=`expr $failed + 1`
+
+testit "noninteractive smbclient does not prompt" \
+ test_noninteractive_no_prompt || \
+ failed=`expr $failed + 1`
+
+testit "noninteractive smbclient -l does not prompt" \
+ test_noninteractive_no_prompt -l /tmp || \
+ failed=`expr $failed + 1`
+
+testit "interactive smbclient prompts on stdout" \
+ test_interactive_prompt_stdout || \
+ failed=`expr $failed + 1`
+
+testit "interactive smbclient -l prompts on stdout" \
+ test_interactive_prompt_stdout -l /tmp || \
+ failed=`expr $failed + 1`
testok $0 $failed
diff --git a/source3/script/tests/tests_smbclient_s3.sh b/source3/script/tests/tests_smbclient_s3.sh
new file mode 100644
index 0000000000..d48a692d4b
--- /dev/null
+++ b/source3/script/tests/tests_smbclient_s3.sh
@@ -0,0 +1 @@
+. $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP