diff options
author | James Peach <jpeach@samba.org> | 2006-01-31 06:09:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:51:39 -0500 |
commit | 60f8666ae88c5a03b0da58acb94015337442e18b (patch) | |
tree | 685a293456b72165d8f5b2192c9fe143c158fa4f /source4/script/tests | |
parent | 99f0659f67eb59d55aeee31bd16614a7ebe282a1 (diff) | |
download | samba-60f8666ae88c5a03b0da58acb94015337442e18b.tar.gz samba-60f8666ae88c5a03b0da58acb94015337442e18b.tar.bz2 samba-60f8666ae88c5a03b0da58acb94015337442e18b.zip |
r13255: New CIFS dd client for use in performance testing. The guts of this is
in client/cifsdd*, which implements a minimal implementation of dd. The
IO path is careful to always perform IO at the requested block size.
There is a very basic test suite in script/tests/test_cifsdd.sh which
covers local and remote IO at a variety of block sizes.
Added to lib/util_str.c is a small set of conv_str_*() functions to
convert strings to the corresponding type.
smbcli_parse_unc is modified to insert NULL terminators after its
hostname and sharename parameters. This allows it to correctly parse a
path of the form //foo/share/path/file.
(This used to be commit cd2f94a65817bfae20ac21b730a2c42d8e581ab3)
Diffstat (limited to 'source4/script/tests')
-rwxr-xr-x | source4/script/tests/test_cifsdd.sh | 84 | ||||
-rwxr-xr-x | source4/script/tests/tests_all.sh | 1 | ||||
-rwxr-xr-x | source4/script/tests/tests_client.sh | 2 |
3 files changed, 87 insertions, 0 deletions
diff --git a/source4/script/tests/test_cifsdd.sh b/source4/script/tests/test_cifsdd.sh new file mode 100755 index 0000000000..9462187f9c --- /dev/null +++ b/source4/script/tests/test_cifsdd.sh @@ -0,0 +1,84 @@ +#!/bin/sh + +# Basic script to make sure that cifsdd can do both local and remote I/O. + +if [ $# -lt 4 ]; then +cat <<EOF +Usage: test_cifsdd.sh SERVER USERNAME PASSWORD DOMAIN +EOF +exit 1; +fi + +SERVER=$1 +USERNAME=$2 +PASSWORD=$3 +DOMAIN=$4 + +DD=bin/cifsdd + +SHARE=tmp +DEBUGLEVEL=4 + +failed=0 + +failtest() { + failed=`expr $failed + 1` +} + +runcopy() { + message="$1" + shift + + testit "$message" $DD --debuglevel=$DEBUGLEVEL -W "$DOMAIN" -U "$USERNAME"%"$PASSWORD" \ + "$@" +} + +compare() { + if [ -r $1 -a -r $2 ] ; then + sum1=`sum $1` + sum2=`sum $2` + + [[ x"$sum1" = x"$sum2" ]] + else + false + fi +} + +incdir=`dirname $0` +. $incdir/test_functions.sh + +sourcepath=tempfile.src.$$ +destpath=tempfile.dst.$$ + +# Create a source file with arbitrary contents +cp $DD $sourcepath + +for bs in 512 4k 48k ; do + +echo "Testing $bs block size ..." + +# Check whether we can do local IO +runcopy "Testing local -> local copy" if=$sourcepath of=$destpath bs=$bs || failtest +compare $sourcepath $destpath || failtest + +# Check whether we can do a round trip +runcopy "Testing local -> remote copy" \ + if=$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs || failtest +runcopy "Testing remote ->local copy" \ + if=//$SERVER/$SHARE/$sourcepath of=$destpath bs=$bs || failtest +compare $sourcepath $destpath || failtest + +# Check that copying within the remote server works +runcopy "Testing local -> remote copy" \ + if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs || failtest +runcopy "Testing remote -> remote copy" \ + if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$destpath bs=$bs || failtest +runcopy "Testing remote ->local copy" \ + if=//$SERVER/$SHARE/$destpath of=$destpath bs=$bs || failtest +compare $sourcepath $destpath || failtest + +done + +rm -f $sourcepath $destpath + +testok $0 $failed diff --git a/source4/script/tests/tests_all.sh b/source4/script/tests/tests_all.sh index e940ec16c1..d5d20d8f92 100755 --- a/source4/script/tests/tests_all.sh +++ b/source4/script/tests/tests_all.sh @@ -10,3 +10,4 @@ $SRCDIR/script/tests/test_local.sh || failed=`expr $failed + $?` $SRCDIR/script/tests/test_pidl.sh || failed=`expr $failed + $?` $SRCDIR/script/tests/test_smbclient.sh $SERVER $USERNAME $PASSWORD $DOMAIN $PREFIX || failed=`expr $failed + $?` + $SRCDIR/script/tests/test_cifsdd.sh $SERVER $USERNAME $PASSWORD $DOMAIN || failed=`expr $failed + $?` diff --git a/source4/script/tests/tests_client.sh b/source4/script/tests/tests_client.sh new file mode 100755 index 0000000000..5a3c5eb79a --- /dev/null +++ b/source4/script/tests/tests_client.sh @@ -0,0 +1,2 @@ + $SRCDIR/script/tests/test_smbclient.sh $SERVER $USERNAME $PASSWORD $DOMAIN $PREFIX || failed=`expr $failed + $?` + $SRCDIR/script/tests/test_cifsdd.sh $SERVER $USERNAME $PASSWORD $DOMAIN || failed=`expr $failed + $?` |