remove_test_data()
{
- rm -rf dir1 dir2 testfile
pushd $WORKDIR
rm -rf dir1 dir2 testfile
popd
}
+clear_download_area() {
+ rm -rf dir1 dir2 testfile
+}
+
test_singlefile_guest()
{
- [ -e testfile ] && rm testfile
+ clear_download_area
echo "$SMBGET -v -a smb://$SERVER_IP/smbget/testfile"
$SMBGET -v -a smb://$SERVER_IP/smbget/testfile
if [ $? -ne 0 ]; then
test_singlefile_U()
{
- [ -e testfile ] && rm testfile
+ clear_download_area
$SMBGET -v -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile
if [ $? -ne 0 ]; then
echo 'ERROR: RC does not match, expected: 0'
test_singlefile_smburl()
{
- [ -e testfile ] && rm testfile
+ clear_download_area
$SMBGET -w $DOMAIN smb://$USERNAME:$PASSWORD@$SERVER_IP/smbget/testfile
if [ $? -ne 0 ]; then
echo 'ERROR: RC does not match, expected: 0'
test_singlefile_rcfile()
{
- [ -e testfile ] && rm testfile
+ clear_download_area
echo "user $USERNAME%$PASSWORD" > $TMPDIR/rcfile
$SMBGET -vn -f $TMPDIR/rcfile smb://$SERVER_IP/smbget/testfile
rc=$?
test_recursive_U()
{
- [ -e testfile ] && rm testfile
- [ -d dir1 ] && rm -rf dir1
- [ -d dir2 ] && rm -rf dir2
+ clear_download_area
$SMBGET -v -R -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/
if [ $? -ne 0 ]; then
echo 'ERROR: RC does not match, expected: 0'
test_resume()
{
- [ -e testfile ] && rm testfile
+ clear_download_area
cp $WORKDIR/testfile .
truncate -s 1024 testfile
$SMBGET -v -r -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile
test_resume_modified()
{
+ clear_download_area
dd if=/dev/urandom bs=1024 count=2 of=testfile
$SMBGET -v -r -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile
if [ $? -ne 1 ]; then
test_update()
{
- [ -e testfile ] && rm testfile
+ clear_download_area
$SMBGET -v -U$USERNAME%$PASSWORD smb://$SERVER_IP/smbget/testfile
if [ $? -ne 0 ]; then
echo 'ERROR: RC does not match, expected: 0'
testit "update" test_update \
|| failed=`expr $failed + 1`
-popd
+clear_download_area
+
+popd # TMPDIR
remove_test_data