From a79f4bfac48702d71b8141013d0ba380440aefb0 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@gmail.com> Date: Fri, 15 Jan 2021 20:44:15 +0100 Subject: [PATCH] Improve backup testing --- test/test_sha512backup.sh | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/test/test_sha512backup.sh b/test/test_sha512backup.sh index 9fe15c1..84e2653 100755 --- a/test/test_sha512backup.sh +++ b/test/test_sha512backup.sh @@ -2,6 +2,7 @@ set -e +TESTFILE=$(mktemp ./delete.me.XXX) TESTDIR=$(mktemp -d /var/tmp/$(basename $0).XXX) cleanup() { set -x @@ -46,8 +47,27 @@ config > "${TESTDIR}/2/TOTALBACKUP.config" #config #../config.py <(config) -../sha512backup --debug --xattr --primary <(config) -../sha512backup --debug --xattr --primary <(config) -find ${TESTDIR} -../md5backup --debug --xattr --primary <(config) -find ${TESTDIR} +../sha512backup --xattr --primary <(config) 2> /dev/null +# Check that source and dest are equal +diff -u <(cd ../test ; find) <(cd ${TESTDIR}/1/test ; find .) +diff -u <(cd ../.git/refs ; find) <(cd ${TESTDIR}/2/.git/refs ; find .) + +# Delete temporary file +rm ${TESTFILE} + +# Make sure source and dest differs +! diff -u <(cd ../test ; find) <(cd ${TESTDIR}/1/test ; find .) +diff -u <(cd ../.git/refs ; find) <(cd ${TESTDIR}/2/.git/refs ; find .) + +# Bring dest to sync +../sha512backup --xattr --primary <(config) 2> /dev/null + +# Check that source and dest are equal +diff -u <(cd ../test ; find) <(cd ${TESTDIR}/1/test ; find .) +diff -u <(cd ../.git/refs ; find) <(cd ${TESTDIR}/2/.git/refs ; find .) +# Check that deleted file exists in TRASH +[ -f ${TESTDIR}/1/TRASH/*/${TESTFILE} ] + +# ../md5backup --xattr --primary <(config) +# find ${TESTDIR} + -- GitLab