s3:tests: Add test for smbclient --quiet
authorJustin Stephenson <jstephen@redhat.com>
Mon, 25 Jun 2018 14:29:28 +0000 (10:29 -0400)
committerKarolin Seeger <kseeger@samba.org>
Tue, 10 Jul 2018 08:44:12 +0000 (10:44 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13485

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Baumbach <bb@sernet.de>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Jun 26 20:29:19 CEST 2018 on sn-devel-144

(cherry picked from commit f90f434e041461fbea2e101066c79ec8caf35cce)

source3/script/tests/test_smbclient_s3.sh

index 706023b7d19279f7a48818607a368acc3645f3bb..264f483ff341c4cb32579fac459f750ba46651df 100755 (executable)
@@ -1598,6 +1598,36 @@ EOF
     return 0
 }
 
+test_server_quiet_message()
+{
+    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+    cat > $tmpfile <<EOF
+ls
+quit
+EOF
+    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmp -I $SERVER_IP $ADDARGS --quiet < $tmpfile 2>&1'
+    eval echo "$cmd"
+    out=`eval $cmd`
+    ret=$?
+    rm -f $tmpfile
+
+    if [ $ret -ne 0 ] ; then
+       echo "$out"
+       echo "failed to connect error $ret"
+       return 1
+    fi
+
+    echo "$out" | grep 'Try "help" to get a list of possible commands.'
+    ret=$?
+    if [ $ret -eq 0 ] ; then
+       echo "$out"
+       echo 'failed - quiet should skip this message.'
+       return 1
+    fi
+
+    return 0
+}
+
 # Test xattr_stream correctly reports mode.
 # BUG: https://bugzilla.samba.org/show_bug.cgi?id=13380
 
@@ -1789,6 +1819,10 @@ testit "server os message" \
     test_server_os_message || \
     failed=`expr $failed + 1`
 
+testit "test server quiet message" \
+    test_server_quiet_message || \
+    failed=`expr $failed + 1`
+
 testit "setmode test" \
     test_setmode || \
     failed=`expr $failed + 1`