1#!/bin/sh 2 3# Basic script to make sure that cifsdd can do both local and remote I/O. 4 5if [ $# -lt 4 ]; then 6cat <<EOF 7Usage: test_cifsdd.sh SERVER USERNAME PASSWORD DOMAIN 8EOF 9exit 1; 10fi 11 12SERVER=$1 13USERNAME=$2 14PASSWORD=$3 15DOMAIN=$4 16 17DD=bin/cifsdd 18 19SHARE=tmp 20DEBUGLEVEL=1 21 22failed=0 23 24failtest() { 25 failed=`expr $failed + 1` 26} 27 28runcopy() { 29 message="$1" 30 shift 31 32 testit "$message" $VALGRIND $DD $CONFIGURATION --debuglevel=$DEBUGLEVEL -W "$DOMAIN" -U "$USERNAME"%"$PASSWORD" \ 33 "$@" 34} 35 36compare() { 37 cmp "$1" "$2" 38} 39 40incdir=`dirname $0` 41. $incdir/test_functions.sh 42 43sourcepath=tempfile.src.$$ 44destpath=tempfile.dst.$$ 45 46# Create a source file with arbitrary contents 47dd if=$DD of=$sourcepath bs=1024 count=50 > /dev/null 48 49ls -l $sourcepath 50 51for bs in 512 4k 48k ; do 52 53echo "Testing $bs block size ..." 54 55# Check whether we can do local IO 56runcopy "Testing local -> local copy" if=$sourcepath of=$destpath bs=$bs || failtest 57compare $sourcepath $destpath || failtest 58 59# Check whether we can do a round trip 60runcopy "Testing local -> remote copy" \ 61 if=$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs || failtest 62runcopy "Testing remote -> local copy" \ 63 if=//$SERVER/$SHARE/$sourcepath of=$destpath bs=$bs || failtest 64compare $sourcepath $destpath || failtest 65 66# Check that copying within the remote server works 67runcopy "Testing local -> remote copy" \ 68 if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs || failtest 69runcopy "Testing remote -> remote copy" \ 70 if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$destpath bs=$bs || failtest 71runcopy "Testing remote -> local copy" \ 72 if=//$SERVER/$SHARE/$destpath of=$destpath bs=$bs || failtest 73compare $sourcepath $destpath || failtest 74 75done 76 77rm -f $sourcepath $destpath 78 79testok $0 $failed 80