s3: smbclient: tests: Test "volume" command over SMB1 and SMB2+.
authorJeremy Allison <jra@samba.org>
Tue, 14 Nov 2017 23:54:19 +0000 (15:54 -0800)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 15 Nov 2017 18:50:54 +0000 (19:50 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13140

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Nov 15 19:50:54 CET 2017 on sn-devel-144

source3/script/tests/test_smbclient_s3.sh

index 45005776cf85974980f8ee018f6f2ac34a7c215a..d98da0dd2606e344e1b04b2a23de82ee6a0b85a2 100755 (executable)
@@ -1525,7 +1525,34 @@ EOF
     fi
 }
 
+# Test doing a volume command.
+test_volume()
+{
+    tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+    cat > $tmpfile <<EOF
+volume
+quit
+EOF
+    cmd='CLI_FORCE_INTERACTIVE=yes $SMBCLIENT "$@" -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 "failed doing volume command with error $ret"
+       return 1
+    fi
+
+    echo "$out" | grep '^Volume: |tmp| serial number'
+    ret=$?
+    if [ $ret != 0 ] ; then
+       echo "$out"
+       echo "failed doing volume command"
+       return 1
+    fi
+}
 
 test_server_os_message()
 {
@@ -1684,6 +1711,10 @@ testit "rename_dotdot" \
     test_rename_dotdot || \
     failed=`expr $failed + 1`
 
+testit "volume" \
+    test_volume || \
+    failed=`expr $failed + 1`
+
 testit "rm -rf $LOGDIR" \
     rm -rf $LOGDIR || \
     failed=`expr $failed + 1`