test/bin-test/test-dav-sync-push-conflict.sh

Sun, 02 Jul 2023 13:23:51 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 02 Jul 2023 13:23:51 +0200
changeset 775
e5909dff0dbf
parent 638
b3077bdb3d77
permissions
-rwxr-xr-x

update ucx

#!/bin/sh
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
#
# Copyright 2019 Olaf Wintermann. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#   1. Redistributions of source code must retain the above copyright
#      notice, this list of conditions and the following disclaimer.
#
#   2. Redistributions in binary form must reproduce the above copyright
#      notice, this list of conditions and the following disclaimer in the
#      documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

#
# Test dav-sync pull conflict detection
# and related commands
#

if [ -z "$DAV_BIN" ];
then
	echo "DAV_BIN variable not set"
	exit 1
fi
if [ -z "$DAV_SYNC_BIN" ];
then
	echo "DAV_BIN variable not set"
	exit 1
fi

# checks if tmp-sync/out.txt contains a specific text
# arg1: pattern
# arg2: errormsg
check_tmpout()
{
	TEST=`cat tmp-sync/out.txt | grep "$1"`
	if [ $? -ne 0 ];
	then
		echo "$2"
		exit 2	
	fi
}

# do dav-sync push and check return value
# arg1: dir
# arg2: errormsg
dav_sync_push()
{
	$DAV_SYNC_BIN push $1 > tmp-sync/out.txt
	if [ $? -ne 0 ];
	then
		echo "$2"
		exit 2
	fi
}
# do dav-sync pull and check return value
# arg1: dir
# arg2: errormsg
dav_sync_pull()
{
	$DAV_SYNC_BIN pull $1 > tmp-sync/out.txt
	if [ $? -ne 0 ];
	then
		echo "$2"
		exit 2
	fi
}

# check if files in test1a and test1b are equal
# arg1: path
# arg2: error
compare_files()
{
	diff tmp-sync/test1a/$1 tmp-sync/test1a/$1 > /dev/null 2>&1
	if [ $? -ne 0 ]; then
		echo "$2"
		exit 2
	fi
}

rm -f .dav/dav-sync-tests-test1a-db.xml
rm -f .dav/dav-sync-tests-test1b-db.xml

$DAV_BIN rm dav-test-repo/sync/test1 2> /dev/null
$DAV_BIN rm dav-test-repo/sync/test2 2> /dev/null

$DAV_BIN mkcol dav-test-repo/sync/test1 2> /dev/null
$DAV_BIN mkcol dav-test-repo/sync/test2 2> /dev/null

# tmp sync dir
rm -Rf tmp-sync
mkdir tmp-sync
mkdir tmp-sync/test1a
mkdir tmp-sync/test1b

# prepare
cp synctest/file1 tmp-sync/test1a
cp synctest/file2 tmp-sync/test1a

mkdir tmp-sync/test1a/dir1/
mkdir tmp-sync/test1a/dir1/subdir1/

cp synctest/file1 tmp-sync/test1a/dir1/
cp synctest/file2 tmp-sync/test1a/dir1/
cp synctest/file3 tmp-sync/test1a/dir1/
cp synctest/file4 tmp-sync/test1a/dir1/

cp synctest/file1 tmp-sync/test1a/dir1/subdir1/
cp synctest/file2 tmp-sync/test1a/dir1/subdir1/
cp synctest/file3 tmp-sync/test1a/dir1/subdir1/
cp synctest/file4 tmp-sync/test1a/dir1/subdir1/
cp synctest/empty1 tmp-sync/test1a/dir1/subdir1/
cp synctest/empty2 tmp-sync/test1a/dir1/subdir1/

dav_sync_push test1a "prepare: push failed"
dav_sync_pull test1b "prepare: pull failed"
sleep 3

# ----------------------------------------------------------------------------
# 1. test: try to push a file, that has changed on the server
# expected result: 1 conflict

echo "test1-mod" >> tmp-sync/test1a/file1

dav_sync_push test1a "test 1: push test1a failed"
check_tmpout "1 file pushed" "test 1: wrong push counter (1)"
check_tmpout "0 conflicts" "test 1: wrong conflict counter(1)"
check_tmpout "0 errors" "test 1: wrong erro counter(1)"

echo "test1-conflict" >> tmp-sync/test1b/file1

dav_sync_push test1b "test 1: push test1b failed"
check_tmpout "0 files pushed" "test 1: wrong push counter (2)"
check_tmpout "1 conflict" "test 1: wrong conflict counter(2)"
check_tmpout "0 errors" "test 1: wrong erro counter(2)"


# ----------------------------------------------------------------------------
# 2. test: try again
# expected result: 1 conflict

dav_sync_push test1b "test 2: push test1b failed"
check_tmpout "0 files pushed" "test 2: wrong push counter"
check_tmpout "1 conflict" "test 2: wrong conflict counter"
check_tmpout "0 errors" "test 2: wrong erro counter"


# ----------------------------------------------------------------------------
# 3. test: try again with -c
# expected result: 1 file pushed, 0 conflicts

$DAV_SYNC_BIN push -c test1b > tmp-sync/out.txt
if [ $? -ne 0 ];
then
	echo "test 1: push test1b failed"
	exit 2
fi

check_tmpout "1 file pushed" "test 3: wrong push counter"
check_tmpout "0 conflicts" "test 3: wrong conflict counter"
check_tmpout "0 errors" "test 3: wrong erro counter"


# ----------------------------------------------------------------------------
# 4. test: get changes in test1a and retry test 1
# expected result: 1 conflict

sleep 3

dav_sync_pull test1a "test 4: pull failed"
check_tmpout "1 file pulled" "test 4: wrong pull counter"
check_tmpout "0 conflicts" "test 4: wrong conflict counter (pull)"
check_tmpout "0 errors" "test 4: wrong error counter (pull)"

echo "test4-mod" >> tmp-sync/test1a/file1

dav_sync_push test1a "test 4: push test1a failed"
check_tmpout "1 file pushed" "test 4: wrong push counter (1)"
check_tmpout "0 conflicts" "test 4: wrong conflict counter(1)"
check_tmpout "0 errors" "test 4: wrong erro counter(1)"

echo "test4-conflict" >> tmp-sync/test1b/file1

dav_sync_push test1b "test 4: push test1b failed"
check_tmpout "0 files pushed" "test 4: wrong push counter (2)"
check_tmpout "1 conflict" "test 4: wrong conflict counter(2)"
check_tmpout "0 errors" "test 4: wrong erro counter(2)"


# ----------------------------------------------------------------------------
# 5. test: check if resolve-conflicts can fix push conflicts
# expected result: resolve-conflicts only resolves pull conflicts

$DAV_SYNC_BIN resolve-conflicts test1b > /dev/null 2>&1

dav_sync_push test1b "test 5: push test1b failed"
check_tmpout "0 files pushed" "test 5: wrong push counter"
check_tmpout "1 conflict" "test 5: wrong conflict counter"
check_tmpout "0 errors" "test 5: wrong erro counter"


# ----------------------------------------------------------------------------
# 6. test: pull (with conflict), push
# expected result: local conflict file, 0 files pushed

sleep 3

dav_sync_pull test1b "test 6: pull failed"
check_tmpout "1 conflict" "test 6: wrong conflict counter (pull)"
check_tmpout "0 errors" "test 6: wrong error counter (pull)"

# check if file1 is a conflict
$DAV_SYNC_BIN list-conflicts test1b > tmp-sync/out.txt
check_tmpout "/file1" "test 6: list-conflicts doesn't list file1 (1)"

dav_sync_push test1b "test 6: push failed"
check_tmpout "0 files pushed" "test 6: wrong push counter"
check_tmpout "0 conflicts" "test 6: wrong conflict counter (push)"
check_tmpout "0 errors" "test 6: wrong error counter (push)"

# check if file1 is a conflict (again)
$DAV_SYNC_BIN list-conflicts test1b > tmp-sync/out.txt
check_tmpout "/file1" "test 6: list-conflicts doesn't list file1 (2)"

# ----------------------------------------------------------------------------
# 7. test: push after resolve-conflicts
# expected result: removes conflict from orig-file -> 1 file pushed

$DAV_SYNC_BIN resolve-conflicts test1b > /dev/null

TEST=`$DAV_SYNC_BIN list-conflicts test1b | wc -l`
if [ $TEST != "0" ]; then
	echo "test 7: list-conflicts not empty"
	exit 2
fi

dav_sync_push test1b "test 7: push failed"
check_tmpout "1 file pushed" "test 7: wrong push counter"
check_tmpout "0 conflicts" "test 7: wrong conflict counter"
check_tmpout "0 errors" "test 7: wrong error counter"


# ----------------------------------------------------------------------------
# 8. test: pull test1a (actually not a push test, but we need to pull test1a)
# expected result: no conflicts

dav_sync_pull test1a "test 8: pull failed"
check_tmpout "0 conflicts" "test 8: wrong conflict counter"
check_tmpout "0 errors" "test 8: wrong error counter"
TEST=`cat tmp-sync/out.txt | wc -l`
if [ $TEST == "1" ]; then
	echo "test 8: no files pulled"
	exit 2
fi


# ----------------------------------------------------------------------------
# 9. test: multiple files modified locally and on the server, push
# expected result: multiple conflicts

sleep 3

# modify 6 files in test1a
echo "test9conflict_a" >> tmp-sync/test1a/file1
echo "test9conflict_a" >> tmp-sync/test1a/file2

echo "test9conflict_a" >> tmp-sync/test1a/dir1/file1
echo "test9conflict_a" >> tmp-sync/test1a/dir1/file2

echo "test9conflict_a" >> tmp-sync/test1a/dir1/subdir1/empty1
echo "test9conflict_a" >> tmp-sync/test1a/dir1/subdir1/empty2

dav_sync_push test1a "test 9: push test1a failed"
check_tmpout "6 files pushed" "test 9: wrong test1a push counter"
check_tmpout "0 conflicts" "test 9: wrong test1a conflict counter"
check_tmpout "0 errors" "test 9: wrong test1a error counter"

# modify 3 files in test1b, which are also modified in test1a
echo "test9conflict_b" >> tmp-sync/test1b/file2
echo "test9conflict_b" >> tmp-sync/test1b/dir1/file2
echo "test9conflict_b" >> tmp-sync/test1b/dir1/subdir1/empty2

# modify 3 files in test1b, that are NOT modified in test1a
echo "test9change_b" >> tmp-sync/test1b/dir1/file3
echo "test9change_b" >> tmp-sync/test1b/dir1/file4
echo "test9change_b" >> tmp-sync/test1b/dir1/subdir1/file1

dav_sync_push test1b "test 9: push test1a failed"
check_tmpout "3 files pushed" "test 9: wrong test1b push counter"
check_tmpout "3 conflicts" "test 9: wrong test1b conflict counter"
check_tmpout "0 errors" "test 9: wrong test1b error counter"


# ----------------------------------------------------------------------------
# 10. test: pull -c to override local changes, modify again and push
# expected result: 3 files pulled, 3 files pushed

sleep 3

$DAV_SYNC_BIN pull -c test1b > tmp-sync/out.txt
if [ $? -ne 0 ];
then
	echo "test 10: pull failed"
	exit 2
fi
check_tmpout "6 files pulled" "test 10: wrong pull counter"
check_tmpout "0 conflicts" "test 10: wrong conflict counter (pull)"
check_tmpout "0 errors" "test 10: wrong error counter (pull)"

# modify 3 files in test1b, which are also modified in test1a
echo "test9conflict_b" >> tmp-sync/test1b/file2
echo "test9conflict_b" >> tmp-sync/test1b/dir1/file2
echo "test9conflict_b" >> tmp-sync/test1b/dir1/subdir1/empty2

dav_sync_push test1b "test 10: push failed"
check_tmpout "3 files pushed" "test 10: wrong push counter"
check_tmpout "0 conflicts" "test 10: wrong conflict counter (push)"
check_tmpout "0 errors" "test 10: wrong error counter (push)"


# ----------------------------------------------------------------------------
# 11. test: create 3 conflicts, push, push again with -c
# expected result: first push: 3 conflicts, second push: 3 files pushed

sleep 3

# prepare test1a (like test 8)
dav_sync_pull test1a "test 11: pull failed"
check_tmpout "0 conflicts" "test 11: wrong conflict counter (pull test1a)"
check_tmpout "0 errors" "test 11: wrong error counter (pull test1a)"
TEST=`cat tmp-sync/out.txt | wc -l`
if [ $TEST == "1" ]; then
	echo "test 11: no files pulled"
	exit 2
fi

sleep 3

# change some files in test1a and push the changes
echo "test11_change_a" >> tmp-sync/test1a/file1
echo "test11_change_a" >> tmp-sync/test1a/file2
echo "test11_change_a" >> tmp-sync/test1a/dir1/file1
echo "test11_change_a" >> tmp-sync/test1a/dir1/file4
echo "test11_change_a" >> tmp-sync/test1a/dir1/subdir1/file3
echo "test11_change_a" >> tmp-sync/test1a/dir1/subdir1/file4
echo "test11_change_a" >> tmp-sync/test1a/dir1/subdir1/empty2

dav_sync_push test1a "test 11: push test1a failed"
check_tmpout "7 files pushed" "test 11: wrong push counter (test1a)"
check_tmpout "0 conflicts" "test 11: wrong conflict counter (test1a)"
check_tmpout "0 errors" "test 11: wrong error counter (test1a)"
check_tmpout "put: /dir1/subdir1/empty2" "empty2 not pushed (test1a)"

# create conflicts
echo "test11_change_a" >> tmp-sync/test1b/file2
echo "test11_change_a" >> tmp-sync/test1b/dir1/file4
echo "test11_change_a" >> tmp-sync/test1b/dir1/subdir1/empty2

# first push with conflicts
dav_sync_push test1b "test 11: push test1b failed"
check_tmpout "0 files pushed" "test 11: wrong push counter (test1b 1)"
check_tmpout "3 conflicts" "test 11: wrong conflict counter (test1b 1)"
check_tmpout "0 errors" "test 11: wrong error counter (test1b 1)"

# second push without conflict detection
$DAV_SYNC_BIN push -c test1b > tmp-sync/out.txt
if [ $? -ne 0 ];
then
	echo "test 11: push test1b failed (2)"
	exit 2
fi
check_tmpout "3 files pushed" "test 11: wrong push counter (test1b 2)"
check_tmpout "0 conflicts" "test 11: wrong conflict counter (test1b 2)"
check_tmpout "0 errors" "test 11: wrong error counter (test1b 2)"


# ----------------------------------------------------------------------------
# 12. test: create new file with same name on both sides
# expected result: conflict

# prepare test1b
dav_sync_pull test1b "test 12: prepare test1b failed"
check_tmpout "0 conflicts" "test 12: wrong conflict counter (prepare)"

# create new file in test1a and push the file
echo "test12_new_a" >> tmp-sync/test1a/file_new1

dav_sync_push test1a "test 12: push test1a failed"
check_tmpout "1 file pushed" "test 12: wrong push counter (test1a)"
check_tmpout "0 conflicts" "test 12: wrong conflict counter (test1a)"
check_tmpout "0 errors" "test 12: wrong error counter (test1a)"

# create new file in test1b and try push the file (conflict)
echo "test12_new_b" >> tmp-sync/test1b/file_new1

dav_sync_push test1b "test 12: push test1b failed"
check_tmpout "0 files pushed" "test 12: wrong push counter (test1b 1)"
check_tmpout "1 conflict" "test 12: wrong conflict counter (test1b 1)"
check_tmpout "0 errors" "test 12: wrong error counter (test1b 1)"

# pull changes to resolve conflict
dav_sync_pull test1b "test 12: pull test1b failed"
check_tmpout "1 file pulled" "test 12: wrong pull counter"
check_tmpout "1 conflict" "test 12: wrong conflict counter (pull)"
check_tmpout "0 errors" "test 12: wrong error counter (pull)"

$DAV_SYNC_BIN resolve-conflicts test1b > tmp-sync/out.txt
if [ $? -ne 0 ];
then
	echo "test 12: resolve-conflicts failed"
	exit 2
fi

dav_sync_push test1b "test 12: push test1b failed (2)"
check_tmpout "1 file pushed" "test 12: wrong push counter (test1b 2)"
check_tmpout "0 conflicts" "test 12: wrong conflict counter (test1b 2)"
check_tmpout "0 errors" "test 12: wrong error counter (test1b 2)"


# ----------------------------------------------------------------------------
# 13. test: 2 new, 2 mod files with conflict
#           2 new, 2 mod files without conflict
# expected result: 4 conflicts, 4 files pushed

dav_sync_pull test1a "test 13: prepare test1a failed"
check_tmpout "0 conflicts" "test 13: wrong conflict counter (prepare test1a)"

sleep 3

echo "test13_change_a" >> tmp-sync/test1a/file1
echo "test13_change_a" >> tmp-sync/test1a/dir1/file4
echo "test13_change_a" >> tmp-sync/test1a/dir1/subdir1/file4
echo "test13_change_a" >> tmp-sync/test1a/dir1/subdir1/empty2

echo "test13_new_a" >> tmp-sync/test1a/test12_newfile1
echo "test13_new_a" >> tmp-sync/test1a/dir1/test12_newfile2
mkdir tmp-sync/test1a/test12/
echo "test13_new_a" >> tmp-sync/test1a/test12/newfile3
echo "test13_new_a" >> tmp-sync/test1a/test12/newfile4

dav_sync_push test1a "test 13: push test1a failed"
check_tmpout "8 files pushed" "test 13: wrong push counter (test1a)"
check_tmpout "0 conflicts" "test 13: wrong conflict counter (test1a)"
check_tmpout "0 errors" "test 13: wrong error counter (test1a)"

echo "test13_change_b" >> tmp-sync/test1b/file2
echo "test13_change_b" >> tmp-sync/test1b/dir1/file4
echo "test13_change_b" >> tmp-sync/test1b/dir1/subdir1/file3
echo "test13_change_b" >> tmp-sync/test1b/dir1/subdir1/empty2

echo "test13_new_b" >> tmp-sync/test1b/test12_newfile1
echo "test13_new_b" >> tmp-sync/test1b/dir1/test12_newfile_b1
mkdir tmp-sync/test1b/test12/
echo "test13_new_b" >> tmp-sync/test1b/test12/newfile3
echo "test13_new_b" >> tmp-sync/test1b/test12/newfile_b1

dav_sync_push test1b "test 13: push test1b failed"
check_tmpout "4 files pushed" "test 13: wrong push counter (test1b)"
check_tmpout "4 conflicts" "test 13: wrong conflict counter (test1b)"
check_tmpout "0 errors" "test 13: wrong error counter (test1b)"

# second push without conflict detection
$DAV_SYNC_BIN push -c test1b > tmp-sync/out.txt
if [ $? -ne 0 ];
then
	echo "test 13: push test1b failed (2)"
	exit 2
fi
check_tmpout "4 files pushed" "test 13: wrong push counter (test1b 2)"
check_tmpout "0 conflicts" "test 13: wrong conflict counter (test1b 2)"
check_tmpout "0 errors" "test 13: wrong error counter (test1b 2)"


# ----------------------------------------------------------------------------
# 14. pull test1a and compare files
# expected result: no conflicts, content of tested files is the same

dav_sync_pull test1a "test 14: pull failed (test1a)"
check_tmpout "0 conflicts" "test 14: wrong pull counter (test1a)"
check_tmpout "0 errors" "test 14: wrong error counter (test1a)"
TEST=`cat tmp-sync/out.txt | wc -l`
if [ $TEST == "1" ]; then
	echo "test 14: no files pulled (test1a)"
	exit 2
fi

dav_sync_pull test1b "test 14: pull failed (test1b)"
check_tmpout "0 conflicts" "test 14: wrong pull counter (test1b)"
check_tmpout "0 errors" "test 14: wrong error counter (test1b)"
TEST=`cat tmp-sync/out.txt | wc -l`
if [ $TEST == "1" ]; then
	echo "test 14: no files pulled (test1b)"
	exit 2
fi

# compare new files
compare_files "file1"                  "test 14: file1 not equal"			  
compare_files "dir1/file4"             "test 14: dir1/file4 not equal"  	  
compare_files "dir1/file3"             "test 14: dir1/file3 not equal"  	  
compare_files "dir1/file2"             "test 14: dir1/file2 not equal"  	  
compare_files "dir1/file1"             "test 14: dir1/file1 not equal"  	  
compare_files "dir1/subdir1/file1"     "test 14: dir1/subdir1/file1 not equal"
compare_files "dir1/subdir1/file2"     "test 14: dir1/subdir1/file2 not equal"
compare_files "dir1/subdir1/file3"     "test 14: dir1/subdir1/file3 not equal"
compare_files "dir1/subdir1/file4"     "test 14: dir1/subdir1/file4 not equal"
compare_files "dir1/subdir1/empty1"    "test 14: dir1/subdir1/empty1 not equal"
compare_files "dir1/subdir1/empty1"    "test 14: dir1/subdir1/empty2 not equal"
compare_files "test12_newfile1"        "test 14: test12_newfile not equal"
compare_files "dir1/test12_newfile2"   "test 14: dir1/test12_newfile2 not equal"
compare_files "test12/newfile3"        "test 14: test12/newfile3 not equal"
compare_files "test12/newfile4"        "test 14: test12/newfile4 not equal"
compare_files "dir1/test12_newfile_b1" "test 14: dir1/test12_newfile_b1 not equal"
compare_files "test12/newfile_b1"      "test 14: test12/newfile_b1 not equal"


# ----------------------------------------------------------------------------
# 15. modify file in test1a, delete in test1b
# expected result: 0 delete

echo "test15_change_a" >> tmp-sync/test1a/file1

dav_sync_push test1a "test 15: push failed (test1a)"
check_tmpout "1 file pushed" "test 15: wrong push counter (test1a)"
check_tmpout "0 conflicts" "test 15: wrong conflict counter (test1a)"
check_tmpout "0 errors" "test 15: wrong error counter (test1a)"

rm tmp-sync/test1b/file1

dav_sync_push test1b "test 15: push failed (test1b)"
check_tmpout "0 files pushed" "test 15: wrong push counter (test1b)"
# not sure if we have to check the conflict counter
check_tmpout "0 errors" "test 15: wrong error counter (test1b)"

dav_sync_pull test1b "test 15: pull failed"
check_tmpout "1 file pulled" "test 15: wrong pull counter"
check_tmpout "0 conflicts" "test 15: wrong conflict counter (pull)"
check_tmpout "0 errors" "test 15: wrong error counter (pull)"

dav_sync_push test1b "test 15: push failed (test1b 2)"
check_tmpout "0 files pushed" "test 15: wrong push counter (test1b 2)"
check_tmpout "0 conflicts" "test 15: wrong conflict counter (test1b 2)"
check_tmpout "0 errors" "test 15: wrong error counter (test1b 2)"


# ----------------------------------------------------------------------------
# 16. test: modify file in test1a/dir1/, delete dir1 in test1b
# expected result: many files deleted, modified file not deleted

sleep 3

echo "test16_change_a" >> tmp-sync/test1a/dir1/file3
echo "test16_change_a" >> tmp-sync/test1a/file2

dav_sync_push test1a "test 16: push failed (test1a)"
check_tmpout "2 files pushed" "test 16: wrong push counter (test1a)"
check_tmpout "0 conflicts" "test 16: wrong conflict counter (test1a)"
check_tmpout "0 errors" "test 16: wrong error counter (test1a)"

rm -Rf tmp-sync/test1b/dir1/

dav_sync_push test1b "test 16: push failed (test1b)"
TEST=`cat tmp-sync/out.txt | grep "delete: /dir1/file3"`
if [ $? -eq 0 ]; then
	echo "test 16: /dir1/file3 deleted"
	exit 2
fi
check_tmpout "delete: /dir1/subdir1/" "test 16: missing delete subdir1"

TEST=`$DAV_BIN list -lR dav-test-repo/sync/test1/dir1 | wc -l`
if [ $TEST != "1" ]; then
	echo "test 16: wrong resource count"
	exit 2
fi

mercurial