testit "$1" cmp "$2" "$3" || failed=`expr $failed + 1`
}
-sourcepath=tempfile.src.$$
-destpath=tempfile.dst.$$
+sourcefile=tempfile.src.$$
+sourcepath=${SELFTEST_TMPDIR}/$sourcefile
+destfile=tempfile.dst.$$
+destpath=${SELFTEST_TMPDIR}/$destfile
# Create a source file with arbitrary contents
dd if=$DD of=$sourcepath bs=1024 count=50 > /dev/null
# Check whether we can do a round trip
runcopy "Testing local -> remote copy" \
- if=$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs
+ if=$sourcepath of=//$SERVER/$SHARE/$sourcefile bs=$bs
runcopy "Testing remote -> local copy" \
- if=//$SERVER/$SHARE/$sourcepath of=$destpath bs=$bs
+ 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/$sourcepath of=//$SERVER/$SHARE/$sourcepath bs=$bs
+ if=//$SERVER/$SHARE/$sourcefile of=//$SERVER/$SHARE/$sourcefile bs=$bs
runcopy "Testing remote -> remote copy" \
- if=//$SERVER/$SHARE/$sourcepath of=//$SERVER/$SHARE/$destpath bs=$bs
+ if=//$SERVER/$SHARE/$sourcefile of=//$SERVER/$SHARE/$destfile bs=$bs
runcopy "Testing remote -> local copy" \
- if=//$SERVER/$SHARE/$destpath of=$destpath bs=$bs
+ if=//$SERVER/$SHARE/$destfile of=$destpath bs=$bs
compare "Checking differences" $sourcepath $destpath
done
testit "share and server list anonymously" $VALGRIND $smbclient -N -L $SERVER $CONFIGURATION $@ || failed=`expr $failed + 1`
# Use the smbclient binary as our test file
-cat $smbclient >tmpfile
+cat $smbclient >$PREFIX/tmpfile
# put that file
-runcmd "MPutting file" 'mput tmpfile' || failed=`expr $failed + 1`
+runcmd "MPutting file" "lcd $PREFIX; mput tmpfile" || failed=`expr $failed + 1`
# check file info
runcmd "Getting alternative name" 'altname tmpfile'|| failed=`expr $failed + 1`
# run allinfo on that file
runcmd "Checking info on file" 'allinfo tmpfile'|| failed=`expr $failed + 1`
# get that file
-mv tmpfile tmpfile-old
-runcmd "MGetting file" 'mget tmpfile' || failed=`expr $failed + 1`
+mv $PREFIX/tmpfile $PREFIX/tmpfile-old
+runcmd "MGetting file" "lcd $PREFIX; mget tmpfile" || failed=`expr $failed + 1`
# remove that file
runcmd "Removing file" 'rm tmpfile' || failed=`expr $failed + 1`
# compare locally
-testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1`
+testit "Comparing files" diff $PREFIX/tmpfile-old $PREFIX/tmpfile || failed=`expr $failed + 1`
# create directory
# cd to directory
# cd to top level directory
runcmd "Getting file system info" 'fsinfo objectid'|| failed=`expr $failed + 1`
# put that file
-runcmd "Putting file" 'put tmpfile'|| failed=`expr $failed + 1`
+runcmd "Putting file" "lcd $PREFIX; put tmpfile" || failed=`expr $failed + 1`
# get that file
-mv tmpfile tmpfile-old
-runcmd "Getting file" 'get tmpfile'|| failed=`expr $failed + 1`
+mv $PREFIX/tmpfile $PREFIX/tmpfile-old
+runcmd "Getting file" "lcd $PREFIX; get tmpfile" || failed=`expr $failed + 1`
runcmd "Getting file EA info" 'eainfo tmpfile'|| failed=`expr $failed + 1`
# remove that file
runcmd "Removing file" 'rm tmpfile' || failed=`expr $failed + 1`
# compare locally
-testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1`
+testit "Comparing files" diff $PREFIX/tmpfile-old $PREFIX/tmpfile || failed=`expr $failed + 1`
# put that file
-runcmd "Putting file with different name" 'put tmpfile tmpfilex' || failed=`expr $failed + 1`
+runcmd "Putting file with different name" "lcd $PREFIX; put tmpfile tmpfilex" || failed=`expr $failed + 1`
# get that file
-runcmd "Getting file again" 'get tmpfilex' || failed=`expr $failed + 1`
+runcmd "Getting file again" "lcd $PREFIX; get tmpfilex" || failed=`expr $failed + 1`
# compare locally
-testit "Comparing files" diff tmpfilex tmpfile || failed=`expr $failed + 1`
+testit "Comparing files" diff $PREFIX/tmpfilex $PREFIX/tmpfile || failed=`expr $failed + 1`
# remove that file
runcmd "Removing file" 'rm tmpfilex'|| failed=`expr $failed + 1`
echo "password=$PASSWORD"
echo "username=$USERNAME"
echo "domain=$DOMAIN"
-) > tmpauthfile
+) > $PREFIX/tmpauthfile
-testit "Test login with --authentication-file" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --authentication-file=tmpauthfile || failed=`expr $failed + 1`
+testit "Test login with --authentication-file" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp --authentication-file=$PREFIX/tmpauthfile || failed=`expr $failed + 1`
-PASSWD_FILE="tmppassfile"
+PASSWD_FILE="$PREFIX/tmppassfile"
echo "$PASSWORD" > $PASSWD_FILE
export PASSWD_FILE
testit "Test login with PASSWD_FILE" $VALGRIND $smbclient -c 'ls' $CONFIGURATION //$SERVER/tmp -W "$DOMAIN" -U"$USERNAME" || failed=`expr $failed + 1`
USER=$oldUSER
export USER
-rm -f tmpfile tmpfile-old tmpfilex tmpauthfile tmppassfile
+rm -f $PREFIX/tmpfile $PREFIX/tmpfile-old $PREFIX/tmpfilex $PREFIX/tmpauthfile $PREFIX/tmppassfile
exit $failed