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

Sat, 22 Jun 2019 16:36:52 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 22 Jun 2019 16:36:52 +0200
changeset 607
5dc7fe41e8f8
parent 571
f6de48471c9c
child 622
6524f45f304e
permissions
-rwxr-xr-x

move some properties to new namespace

for properties encryption we need to decide which props must be encrypted and the plan is, to decide by namespace

#!/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.
#

if [ $# -lt 2 ];
then
	echo "usage:" $0 "<dav-binary> <dav-sync-binary>"
	exit 1
fi

# check if binaries exist
which $1 > /dev/null
if [ $? -ne 0 ];
then
	exit 1
fi
which $2 > /dev/null
if [ $? -ne 0 ];
then
	exit 1
fi

DAV_BIN=$1
DAV_SYNC_BIN=$2
export DAV_BIN
export DAV_SYNC_BIN

# create config
rm -Rf .dav
cp -R $HOME/.dav/ .dav/
cp dav-home/sync.xml .dav/sync.xml
export HOME=`pwd`

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

# check if config works
TEST1_DIR=`$DAV_SYNC_BIN list-dirs | grep test1a | tail -n 1`
if [ -z $TEST1_DIR ];
then
	echo "Config not working"
	rm -Rf .dav
	rm -Rf tmp-sync
	exit 1
fi

# clean test repo and files
$DAV_BIN rm -N dav-test-repo/tests/ 2> /dev/null
$DAV_BIN rm -N dav-test-repo/sync/ 2> /dev/null

do_test()
{
	printf "TEST: $1 ... "
	./$2
	if [ $? -ne 0 ]; then
		rm -Rf .dav
		exit 2
	fi
	echo ok
}

#
# ok, begin the tests
#
do_test "dav-sync push (1)" test-dav-sync-push1.sh

# cleanup
rm -Rf .dav
rm -Rf tmp-sync

mercurial