svn commit: samba r16273 - branches/SAMBA_3_0/source/script/tests
trunk/source/script/tests
jpeach at samba.org
jpeach at samba.org
Thu Jun 15 23:47:42 GMT 2006
Author: jpeach
Date: 2006-06-15 23:47:41 +0000 (Thu, 15 Jun 2006)
New Revision: 16273
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16273
Log:
Add smbclient tests to verify that
in interactive mode, smbclient always prompts on stdout
in non-interactive mode, smbclient never prompts
Added:
branches/SAMBA_3_0/source/script/tests/tests_smbclient_s3.sh
trunk/source/script/tests/tests_smbclient_s3.sh
Modified:
branches/SAMBA_3_0/source/script/tests/test_smbclient_s3.sh
trunk/source/script/tests/test_smbclient_s3.sh
Changeset:
Modified: branches/SAMBA_3_0/source/script/tests/test_smbclient_s3.sh
===================================================================
--- branches/SAMBA_3_0/source/script/tests/test_smbclient_s3.sh 2006-06-15 21:59:25 UTC (rev 16272)
+++ branches/SAMBA_3_0/source/script/tests/test_smbclient_s3.sh 2006-06-15 23:47:41 UTC (rev 16273)
@@ -11,13 +11,67 @@
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
Added: branches/SAMBA_3_0/source/script/tests/tests_smbclient_s3.sh
===================================================================
--- branches/SAMBA_3_0/source/script/tests/tests_smbclient_s3.sh 2006-06-15 21:59:25 UTC (rev 16272)
+++ branches/SAMBA_3_0/source/script/tests/tests_smbclient_s3.sh 2006-06-15 23:47:41 UTC (rev 16273)
@@ -0,0 +1 @@
+. $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP
Modified: trunk/source/script/tests/test_smbclient_s3.sh
===================================================================
--- trunk/source/script/tests/test_smbclient_s3.sh 2006-06-15 21:59:25 UTC (rev 16272)
+++ trunk/source/script/tests/test_smbclient_s3.sh 2006-06-15 23:47:41 UTC (rev 16273)
@@ -11,13 +11,67 @@
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
Added: trunk/source/script/tests/tests_smbclient_s3.sh
===================================================================
--- trunk/source/script/tests/tests_smbclient_s3.sh 2006-06-15 21:59:25 UTC (rev 16272)
+++ trunk/source/script/tests/tests_smbclient_s3.sh 2006-06-15 23:47:41 UTC (rev 16273)
@@ -0,0 +1 @@
+. $SCRIPTDIR/test_smbclient_s3.sh $SERVER $SERVER_IP
More information about the samba-cvs
mailing list