2006-06-04 20:36:52 +00:00
#!/bin/sh
2006-01-31 06:09:18 +00:00
# Basic script to make sure that cifsdd can do both local and remote I/O.
if [ $# -lt 4 ] ; then
2022-02-23 11:59:24 +01:00
cat <<EOF
2006-01-31 06:09:18 +00:00
Usage: test_cifsdd.sh SERVER USERNAME PASSWORD DOMAIN
EOF
2022-02-23 11:59:24 +01:00
exit 1
2006-01-31 06:09:18 +00:00
fi
SERVER = $1
USERNAME = $2
PASSWORD = $3
DOMAIN = $4
2022-02-23 11:59:24 +01:00
. $( dirname $0 ) /../../../testprogs/blackbox/subunit.sh
2008-04-16 14:52:29 +02:00
2011-04-15 12:41:22 +10:00
samba4bindir = " $BINDIR "
2012-01-26 09:42:27 +11:00
DD = " $samba4bindir /cifsdd "
2006-01-31 06:09:18 +00:00
SHARE = tmp
2006-09-22 15:14:53 +00:00
DEBUGLEVEL = 1
2006-01-31 06:09:18 +00:00
2022-02-23 11:59:24 +01:00
runcopy( )
{
2006-01-31 06:09:18 +00:00
message = " $1 "
shift
2022-02-23 11:59:24 +01:00
2006-10-16 20:20:03 +00:00
testit " $message " $VALGRIND $DD $CONFIGURATION --debuglevel= $DEBUGLEVEL -W " $DOMAIN " -U " $USERNAME " %" $PASSWORD " \
2022-02-23 11:59:24 +01:00
" $@ " || failed = $( expr $failed + 1)
2006-01-31 06:09:18 +00:00
}
2022-02-23 11:59:24 +01:00
compare( )
{
testit " $1 " cmp " $2 " " $3 " || failed = $( expr $failed + 1)
2006-01-31 06:09:18 +00:00
}
2020-11-23 09:58:30 +01:00
sourcefile = tempfile.src.$$
sourcepath = ${ SELFTEST_TMPDIR } /$sourcefile
destfile = tempfile.dst.$$
destpath = ${ SELFTEST_TMPDIR } /$destfile
2006-01-31 06:09:18 +00:00
# Create a source file with arbitrary contents
2022-02-23 11:59:24 +01:00
dd if = $DD of = $sourcepath bs = 1024 count = 50 >/dev/null
2006-09-22 15:14:53 +00:00
ls -l $sourcepath
2006-01-31 06:09:18 +00:00
2022-02-23 11:59:24 +01:00
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
compare "Checking local differences" $sourcepath $destpath
# Check whether we can do a round trip
runcopy "Testing local -> remote copy" \
if = $sourcepath of = //$SERVER /$SHARE /$sourcefile bs = $bs
runcopy "Testing remote -> local copy" \
if = //$SERVER /$SHARE /$sourcefile of = $destpath bs = $bs
compare "Checking differences" $sourcepath $destpath
# Check that copying within the remote server works
runcopy "Testing local -> remote copy" \
if = //$SERVER /$SHARE /$sourcefile of = //$SERVER /$SHARE /$sourcefile bs = $bs
runcopy "Testing remote -> remote copy" \
if = //$SERVER /$SHARE /$sourcefile of = //$SERVER /$SHARE /$destfile bs = $bs
runcopy "Testing remote -> local copy" \
if = //$SERVER /$SHARE /$destfile of = $destpath bs = $bs
compare "Checking differences" $sourcepath $destpath
2006-01-31 06:09:18 +00:00
done
rm -f $sourcepath $destpath
2007-01-14 01:39:34 +00:00
exit $failed