s3: Fix Coverity ID 703869 Logically dead code
[Samba/gebeck_regimport.git] / source4 / client / tests / test_cifsdd.sh
blobe59d37ae7bb81628817b3ef1ef16a5372c23b31b
1 #!/bin/sh
3 # Basic script to make sure that cifsdd can do both local and remote I/O.
5 if [ $# -lt 4 ]; then
6 cat <<EOF
7 Usage: test_cifsdd.sh SERVER USERNAME PASSWORD DOMAIN
8 EOF
9 exit 1;
12 SERVER=$1
13 USERNAME=$2
14 PASSWORD=$3
15 DOMAIN=$4
17 . `dirname $0`/../../../testprogs/blackbox/subunit.sh
19 samba4bindir="$BINDIR"
20 DD="$samba4bindir/cifsdd"
22 SHARE=tmp
23 DEBUGLEVEL=1
25 runcopy() {
26 message="$1"
27 shift
29 testit "$message" $VALGRIND $DD $CONFIGURATION --debuglevel=$DEBUGLEVEL -W "$DOMAIN" -U "$USERNAME"%"$PASSWORD" \
30 "$@" || failed=`expr $failed + 1`
33 compare() {
34 testit "$1" cmp "$2" "$3" || failed=`expr $failed + 1`
37 sourcepath=tempfile.src.$$
38 destpath=tempfile.dst.$$
40 # Create a source file with arbitrary contents
41 dd if=$DD of=$sourcepath bs=1024 count=50 > /dev/null
43 ls -l $sourcepath
45 for bs in 512 4k 48k ; do
47 echo "Testing $bs block size ..."
49 # Check whether we can do local IO
50 runcopy "Testing local -> local copy" if=$sourcepath of=$destpath bs=$bs
51 compare "Checking local differences" $sourcepath $destpath
53 # Check whether we can do a round trip
54 runcopy "Testing local -> remote copy" \
55 if=$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs
56 runcopy "Testing remote -> local copy" \
57 if=//$SERVER/$SHARE/$sourcepath of=$destpath bs=$bs
58 compare "Checking differences" $sourcepath $destpath
60 # Check that copying within the remote server works
61 runcopy "Testing local -> remote copy" \
62 if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs
63 runcopy "Testing remote -> remote copy" \
64 if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$destpath bs=$bs
65 runcopy "Testing remote -> local copy" \
66 if=//$SERVER/$SHARE/$destpath of=$destpath bs=$bs
67 compare "Checking differences" $sourcepath $destpath
69 done
71 rm -f $sourcepath $destpath
73 exit $failed