source: trunk/server/source4/client/tests/test_cifsdd.sh

Last change on this file was 414, checked in by Herwig Bauernfeind, 16 years ago

Samba 3.5.0: Initial import

File size: 1.8 KB
Line 
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
17. `dirname $0`/../../../testprogs/blackbox/subunit.sh
18
19samba4bindir="$BUILDDIR/bin"
20DD="$samba4bindir/cifsdd$EXEEXT"
21
22SHARE=tmp
23DEBUGLEVEL=1
24
25runcopy() {
26 message="$1"
27 shift
28
29 testit "$message" $VALGRIND $DD $CONFIGURATION --debuglevel=$DEBUGLEVEL -W "$DOMAIN" -U "$USERNAME"%"$PASSWORD" \
30 "$@" || failed=`expr $failed + 1`
31}
32
33compare() {
34 testit "$1" cmp "$2" "$3" || failed=`expr $failed + 1`
35}
36
37sourcepath=tempfile.src.$$
38destpath=tempfile.dst.$$
39
40# Create a source file with arbitrary contents
41dd if=$DD of=$sourcepath bs=1024 count=50 > /dev/null
42
43ls -l $sourcepath
44
45for bs in 512 4k 48k ; do
46
47echo "Testing $bs block size ..."
48
49# Check whether we can do local IO
50runcopy "Testing local -> local copy" if=$sourcepath of=$destpath bs=$bs
51compare "Checking local differences" $sourcepath $destpath
52
53# Check whether we can do a round trip
54runcopy "Testing local -> remote copy" \
55 if=$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs
56runcopy "Testing remote -> local copy" \
57 if=//$SERVER/$SHARE/$sourcepath of=$destpath bs=$bs
58compare "Checking differences" $sourcepath $destpath
59
60# Check that copying within the remote server works
61runcopy "Testing local -> remote copy" \
62 if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs
63runcopy "Testing remote -> remote copy" \
64 if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$destpath bs=$bs
65runcopy "Testing remote -> local copy" \
66 if=//$SERVER/$SHARE/$destpath of=$destpath bs=$bs
67compare "Checking differences" $sourcepath $destpath
68
69done
70
71rm -f $sourcepath $destpath
72
73exit $failed
Note: See TracBrowser for help on using the repository browser.