summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-09 15:22:19 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-09 12:40:09 +0200
commitbb00f97a82aea24bbf95de4dbd788d32bd34b427 (patch)
tree7c5be5ccb03e189aacbb2e2b9c0a894c01bb7f80 /source3
parentdaf79e33c7e8873345fb4a251f1e880fd767df19 (diff)
downloadsamba-bb00f97a82aea24bbf95de4dbd788d32bd34b427.tar.gz
samba-bb00f97a82aea24bbf95de4dbd788d32bd34b427.tar.xz
samba-bb00f97a82aea24bbf95de4dbd788d32bd34b427.zip
s3-selftest Add a test for 'message command'
This also provides us a way to test that the -n option to smbclient works, as that becomes part of the filename. Andrew Bartlett
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 0395f3e12c..60c3610ee8 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -218,6 +218,7 @@ EOF
if [ $ret != 0 ] ; then
echo "$out"
echo "failed writing into read-only directory with error $ret"
+
false
return
fi
@@ -235,6 +236,49 @@ EOF
fi
}
+
+# Test sending a message
+test_message()
+{
+ tmpfile=$PREFIX/message_in.$$
+
+ cat > $tmpfile <<EOF
+Test message from pid $$
+EOF
+
+ cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD -M $SERVER -p 139 $ADDARGS -n msgtest < $tmpfile 2>&1'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ ret=$?
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed sending message to $SERVER with error $ret"
+ false
+ rm -f $tmpfile
+ return
+ fi
+
+ cmd='$SMBCLIENT "$@" -U$USERNAME%$PASSWORD //$SERVER/tmpguest -p 139 $ADDARGS -c "get message.msgtest $PREFIX/message_out.$$" 2>&1'
+ eval echo "$cmd"
+ out=`eval $cmd`
+ ret=$?
+
+ if [ $ret != 0 ] ; then
+ echo "$out"
+ echo "failed getting sent message from $SERVER with error $ret"
+ false
+ return
+ fi
+
+ if [ cmp $PREFIX/message_out.$$ $tmpfile != 0 ] ; then
+ echo "failed comparison of message from $SERVER"
+ false
+ return
+ fi
+ true
+}
+
# Test reading an owner-only file (logon as guest) fails.
test_owner_only_file()
{
@@ -444,6 +488,10 @@ testit "ccache access works for smbclient" \
test_ccache_access || \
failed=`expr $failed + 1`
+testit "sending a message to the remote server" \
+ test_message || \
+ failed=`expr $failed + 1`
+
testit "rm -rf $LOGDIR" \
rm -rf $LOGDIR || \
failed=`expr $failed + 1`