mirror of
https://github.com/usatiuk/backup.git
synced 2025-10-26 17:37:47 +01:00
parallel tests
This commit is contained in:
4
.github/workflows/cmake.yml
vendored
4
.github/workflows/cmake.yml
vendored
@@ -8,7 +8,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||||
BUILD_TYPE: Debug
|
BUILD_TYPE: RelWithDebInfo
|
||||||
SANITIZE: YES
|
SANITIZE: YES
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -37,4 +37,4 @@ jobs:
|
|||||||
working-directory: ${{github.workspace}}/build
|
working-directory: ${{github.workspace}}/build
|
||||||
# Execute tests defined by the CMake configuration.
|
# Execute tests defined by the CMake configuration.
|
||||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||||
run: ctest --verbose -C ${{env.BUILD_TYPE}}
|
run: ctest --verbose --parallel $(nproc) -C ${{env.BUILD_TYPE}}
|
||||||
|
|||||||
@@ -5,64 +5,65 @@ TESTSIZE=16
|
|||||||
# TODO: Don't hardcode this
|
# TODO: Don't hardcode this
|
||||||
CMD="../../src/backup"
|
CMD="../../src/backup"
|
||||||
|
|
||||||
rm -rf testdata
|
TESTDATADIR=backup
|
||||||
rm -rf testdir
|
|
||||||
|
|
||||||
mkdir -p testdir
|
rm -rf "$TESTDATADIR"
|
||||||
mkdir -p testdata/1
|
|
||||||
mkdir -p testdata/1/empty
|
mkdir -p "$TESTDATADIR"/testdir
|
||||||
mkdir -p testdata/1/notempty
|
mkdir -p "$TESTDATADIR"/testdata/1
|
||||||
echo "testtestasdf" > testdata/1/notempty/testfile
|
mkdir -p "$TESTDATADIR"/testdata/1/empty
|
||||||
|
mkdir -p "$TESTDATADIR"/testdata/1/notempty
|
||||||
|
echo "testtestasdf" > "$TESTDATADIR"/testdata/1/notempty/testfile
|
||||||
|
|
||||||
|
|
||||||
dd if=/dev/urandom of=testdata/1/a bs=1M count=$TESTSIZE
|
dd if=/dev/urandom of="$TESTDATADIR"/testdata/1/a bs=1M count=$TESTSIZE
|
||||||
dd if=/dev/urandom of=testdata/1/b bs=1M count=$TESTSIZE
|
dd if=/dev/urandom of="$TESTDATADIR"/testdata/1/b bs=1M count=$TESTSIZE
|
||||||
dd if=/dev/urandom of=testdata/1/c bs=1M count=$TESTSIZE
|
dd if=/dev/urandom of="$TESTDATADIR"/testdata/1/c bs=1M count=$TESTSIZE
|
||||||
|
|
||||||
ln -s a testdata/1/l
|
ln -s a "$TESTDATADIR"/testdata/1/l
|
||||||
ln -s aa testdata/1/aa
|
ln -s aa "$TESTDATADIR"/testdata/1/aa
|
||||||
|
|
||||||
cp -a -p testdata/1 testdata/2
|
cp -a -p "$TESTDATADIR"/testdata/1 "$TESTDATADIR"/testdata/2
|
||||||
echo "asdf1" > testdata/2/c
|
echo "asdf1" > "$TESTDATADIR"/testdata/2/c
|
||||||
cat testdata/1/c >> testdata/2/c
|
cat "$TESTDATADIR"/testdata/1/c >> "$TESTDATADIR"/testdata/2/c
|
||||||
|
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
||||||
cp -a -p testdata/2 testdata/3
|
cp -a -p "$TESTDATADIR"/testdata/2 "$TESTDATADIR"/testdata/3
|
||||||
echo "asdf2" > testdata/3/a
|
echo "asdf2" > "$TESTDATADIR"/testdata/3/a
|
||||||
cat testdata/2/a >> testdata/3/a
|
cat "$TESTDATADIR"/testdata/2/a >> "$TESTDATADIR"/testdata/3/a
|
||||||
rm testdata/3/l
|
rm "$TESTDATADIR"/testdata/3/l
|
||||||
ln -s b testdata/3/l
|
ln -s b "$TESTDATADIR"/testdata/3/l
|
||||||
|
|
||||||
cp -a -p testdata/3 testdata/4
|
cp -a -p "$TESTDATADIR"/testdata/3 "$TESTDATADIR"/testdata/4
|
||||||
echo "asdf3" > testdata/4/b
|
echo "asdf3" > "$TESTDATADIR"/testdata/4/b
|
||||||
cat testdata/3/b >> testdata/4/b
|
cat "$TESTDATADIR"/testdata/3/b >> "$TESTDATADIR"/testdata/4/b
|
||||||
|
|
||||||
cp -a -p testdata/1 testdata/5
|
cp -a -p "$TESTDATADIR"/testdata/1 "$TESTDATADIR"/testdata/5
|
||||||
cp -a -p testdata/1 testdata/6
|
cp -a -p "$TESTDATADIR"/testdata/1 "$TESTDATADIR"/testdata/6
|
||||||
rm testdata/6/a
|
rm "$TESTDATADIR"/testdata/6/a
|
||||||
cp -a -p testdata/1 testdata/7
|
cp -a -p "$TESTDATADIR"/testdata/1 "$TESTDATADIR"/testdata/7
|
||||||
|
|
||||||
cp -a -p testdata/7 testdata/8
|
cp -a -p "$TESTDATADIR"/testdata/7 "$TESTDATADIR"/testdata/8
|
||||||
echo "asdf3" > testdata/8/b
|
echo "asdf3" > "$TESTDATADIR"/testdata/8/b
|
||||||
cat testdata/7/b >> testdata/8/b
|
cat "$TESTDATADIR"/testdata/7/b >> "$TESTDATADIR"/testdata/8/b
|
||||||
|
|
||||||
echo "Data created"
|
echo "Data created"
|
||||||
|
|
||||||
if ! $CMD init --repo testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
if ! $CMD init --repo "$TESTDATADIR"/testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
||||||
echo "Error creating repo!"
|
echo "Error creating repo!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Repo created"
|
echo "Repo created"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied: aa' ) && ( echo "$OUT" | grep -q 'Copied: b' ) && ( echo "$OUT" | grep -q 'Copied: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied: aa' ) && ( echo "$OUT" | grep -q 'Copied: b' ) && ( echo "$OUT" | grep -q 'Copied: c' ) ); then
|
||||||
echo "Error backing up 1 dir!"
|
echo "Error backing up 1 dir!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Backup 1 ok"
|
echo "Backup 1 ok"
|
||||||
OUT=$($CMD run --from testdata/2 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/2 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) &&\
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) &&\
|
||||||
( echo "$OUT" | grep -q 'Skipped: empty' ) && ( echo "$OUT" | grep -q 'Skipped: l' ) && ( echo "$OUT" | grep -q 'Skipped: notempty' ) && ( echo "$OUT" | grep -q 'Copied: c' ) ); then
|
( echo "$OUT" | grep -q 'Skipped: empty' ) && ( echo "$OUT" | grep -q 'Skipped: l' ) && ( echo "$OUT" | grep -q 'Skipped: notempty' ) && ( echo "$OUT" | grep -q 'Copied: c' ) ); then
|
||||||
@@ -71,7 +72,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skippe
|
|||||||
fi
|
fi
|
||||||
echo "Backup 2 ok"
|
echo "Backup 2 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/3 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/3 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied: l' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) &&\
|
if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied: l' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) &&\
|
||||||
( echo "$OUT" | grep -q 'Skipped: empty' ) && ( echo "$OUT" | grep -q 'Skipped: notempty' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
( echo "$OUT" | grep -q 'Skipped: empty' ) && ( echo "$OUT" | grep -q 'Skipped: notempty' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
@@ -81,7 +82,7 @@ if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied:
|
|||||||
fi
|
fi
|
||||||
echo "Backup 3 ok"
|
echo "Backup 3 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/4 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Copied: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Copied: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 4 dir!"
|
echo "Error backing up 4 dir!"
|
||||||
@@ -89,7 +90,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skippe
|
|||||||
fi
|
fi
|
||||||
echo "Backup 4 ok"
|
echo "Backup 4 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/5 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/5 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied: b' ) && ( echo "$OUT" | grep -q 'Copied: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied: b' ) && ( echo "$OUT" | grep -q 'Copied: c' ) ); then
|
||||||
echo "Error backing up 5 dir!"
|
echo "Error backing up 5 dir!"
|
||||||
@@ -97,7 +98,7 @@ if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied:
|
|||||||
fi
|
fi
|
||||||
echo "Backup 5 ok"
|
echo "Backup 5 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/6 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/6 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ! ( echo "$OUT" | grep -q 'Copied: a' ) && ! ( echo "$OUT" | grep -q 'Skipped: a ' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ! ( echo "$OUT" | grep -q 'Copied: a' ) && ! ( echo "$OUT" | grep -q 'Skipped: a ' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 6 dir!"
|
echo "Error backing up 6 dir!"
|
||||||
@@ -105,7 +106,7 @@ if ! ( ! ( echo "$OUT" | grep -q 'Copied: a' ) && ! ( echo "$OUT" | grep -q 'Ski
|
|||||||
fi
|
fi
|
||||||
echo "Backup 6 ok"
|
echo "Backup 6 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/7 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/7 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 7 dir!"
|
echo "Error backing up 7 dir!"
|
||||||
@@ -117,22 +118,22 @@ echo "Backup 7 ok"
|
|||||||
|
|
||||||
i=$((0))
|
i=$((0))
|
||||||
AIDS=()
|
AIDS=()
|
||||||
OUT=$($CMD list --repo testdir/to1 --password asdff)
|
OUT=$($CMD list --repo "$TESTDATADIR"/testdir/to1 --password asdff)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
|
|
||||||
mkdir testmount
|
mkdir "$TESTDATADIR"/testmount
|
||||||
$CMD mount --repo testdir/to1 --password asdff --to testmount &
|
$CMD mount --repo "$TESTDATADIR"/testdir/to1 --password asdff --to "$TESTDATADIR"/testmount &
|
||||||
|
|
||||||
while IFS= read -r l; do
|
while IFS= read -r l; do
|
||||||
((i++))
|
((i++))
|
||||||
aid=$(echo $l | grep -Eo '[0-9]+' | tail -1)
|
aid=$(echo $l | grep -Eo '[0-9]+' | tail -1)
|
||||||
AIDS+=("$aid")
|
AIDS+=("$aid")
|
||||||
$CMD restore --repo testdir/to1 --password asdff --aid $aid --to testdir/res$((i))
|
$CMD restore --repo "$TESTDATADIR"/testdir/to1 --password asdff --aid $aid --to "$TESTDATADIR"/testdir/res$((i))
|
||||||
if ! diff --no-dereference -r testdata/$((i)) testdir/res$((i)); then
|
if ! diff --no-dereference -r "$TESTDATADIR"/testdata/$((i)) "$TESTDATADIR"/testdir/res$((i)); then
|
||||||
echo "Archive not restored properly!"
|
echo "Archive not restored properly!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if ! diff --no-dereference -r testmount/$((aid)) testdir/res$((i)); then
|
if ! diff --no-dereference -r "$TESTDATADIR"/testmount/$((aid)) "$TESTDATADIR"/testdir/res$((i)); then
|
||||||
echo "Archive not mounted properly!"
|
echo "Archive not mounted properly!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -140,9 +141,9 @@ while IFS= read -r l; do
|
|||||||
echo "Restore $((i)) OK"
|
echo "Restore $((i)) OK"
|
||||||
done <<< "$OUT"
|
done <<< "$OUT"
|
||||||
|
|
||||||
umount testmount
|
umount "$TESTDATADIR"/testmount
|
||||||
|
|
||||||
OUT=$($CMD diff --from testdata/4 --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[0]} --aid2 ${AIDS[1]})
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[0]} --aid2 ${AIDS[1]})
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'c is different' ) && ! ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -q 'l is different' )\
|
if ! ( ( echo "$OUT" | grep -q 'c is different' ) && ! ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -q 'l is different' )\
|
||||||
&& ! ( echo "$OUT" | grep -q 'aa is different' ) && ! ( echo "$OUT" | grep -q 'b is different' ) && ! ( echo "$OUT" | grep -q 'empty is different' ) && ! ( echo "$OUT" | grep -q 'notempty is different' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'aa is different' ) && ! ( echo "$OUT" | grep -q 'b is different' ) && ! ( echo "$OUT" | grep -q 'empty is different' ) && ! ( echo "$OUT" | grep -q 'notempty is different' ) ); then
|
||||||
@@ -152,7 +153,7 @@ fi
|
|||||||
echo "OK comparing archive 1 and 2"
|
echo "OK comparing archive 1 and 2"
|
||||||
|
|
||||||
|
|
||||||
OUT=$($CMD diff --from testdata/4 --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'a is different' ) && ( echo "$OUT" | grep -q 'l is different' ) && ! ( echo "$OUT" | grep -q 'c is different' ) \
|
if ! ( ( echo "$OUT" | grep -q 'a is different' ) && ( echo "$OUT" | grep -q 'l is different' ) && ! ( echo "$OUT" | grep -q 'c is different' ) \
|
||||||
&& ! ( echo "$OUT" | grep -q 'b is different' ) && ! ( echo "$OUT" | grep -q 'empty is different' ) && ! ( echo "$OUT" | grep -q 'notempty is different' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'b is different' ) && ! ( echo "$OUT" | grep -q 'empty is different' ) && ! ( echo "$OUT" | grep -q 'notempty is different' ) ); then
|
||||||
@@ -161,7 +162,7 @@ if ! ( ( echo "$OUT" | grep -q 'a is different' ) && ( echo "$OUT" | grep -q 'l
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive 2 and 3"
|
echo "OK comparing archive 2 and 3"
|
||||||
|
|
||||||
OUT=$($CMD diff --diff-mode file --from testdata/4 --prefix a --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
OUT=$($CMD diff --diff-mode file --from "$TESTDATADIR"/testdata/4 --prefix a --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -q 'l is different' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -q 'l is different' ) ); then
|
||||||
echo "Error comparing archive 2 and 3! (file 1)"
|
echo "Error comparing archive 2 and 3! (file 1)"
|
||||||
@@ -169,7 +170,7 @@ if ! ( ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -q '
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive 2 and 3 (file 1)"
|
echo "OK comparing archive 2 and 3 (file 1)"
|
||||||
|
|
||||||
OUT=$($CMD diff --diff-mode file --from testdata/4 --prefix l --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
OUT=$($CMD diff --diff-mode file --from "$TESTDATADIR"/testdata/4 --prefix l --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ! ( echo "$OUT" | grep -q 'a is different' ) && ( echo "$OUT" | grep -q 'l is different' ) ); then
|
if ! ( ! ( echo "$OUT" | grep -q 'a is different' ) && ( echo "$OUT" | grep -q 'l is different' ) ); then
|
||||||
echo "Error comparing archive 2 and 3! (file 2)"
|
echo "Error comparing archive 2 and 3! (file 2)"
|
||||||
@@ -177,7 +178,7 @@ if ! ( ! ( echo "$OUT" | grep -q 'a is different' ) && ( echo "$OUT" | grep -q '
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive 2 and 3 (file 2)"
|
echo "OK comparing archive 2 and 3 (file 2)"
|
||||||
|
|
||||||
OUT=$($CMD diff --diff-mode file --from testdata/4 --prefix b --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
OUT=$($CMD diff --diff-mode file --from "$TESTDATADIR"/testdata/4 --prefix b --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ! ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -q 'l is different' ) && ( echo "$OUT" | grep -q 'b are same' ) ); then
|
if ! ( ! ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -q 'l is different' ) && ( echo "$OUT" | grep -q 'b are same' ) ); then
|
||||||
echo "Error comparing archive 2 and 3! (file 3)"
|
echo "Error comparing archive 2 and 3! (file 3)"
|
||||||
@@ -185,7 +186,7 @@ if ! ( ! ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive 2 and 3 (file 3)"
|
echo "OK comparing archive 2 and 3 (file 3)"
|
||||||
|
|
||||||
OUT=$($CMD diff --from testdata/4 --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]})
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]})
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'b is different' ) && ! ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -q 'l is different' ) \
|
if ! ( ( echo "$OUT" | grep -q 'b is different' ) && ! ( echo "$OUT" | grep -q 'a is different' ) && ! ( echo "$OUT" | grep -q 'l is different' ) \
|
||||||
&& ! ( echo "$OUT" | grep -q 'aa is different' ) && ! ( echo "$OUT" | grep -q 'c is different' ) && ! ( echo "$OUT" | grep -q 'empty is different' ) && ! ( echo "$OUT" | grep -q 'notempty is different' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'aa is different' ) && ! ( echo "$OUT" | grep -q 'c is different' ) && ! ( echo "$OUT" | grep -q 'empty is different' ) && ! ( echo "$OUT" | grep -q 'notempty is different' ) ); then
|
||||||
@@ -194,7 +195,7 @@ if ! ( ( echo "$OUT" | grep -q 'b is different' ) && ! ( echo "$OUT" | grep -q '
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive 3 and current"
|
echo "OK comparing archive 3 and current"
|
||||||
|
|
||||||
OUT=$($CMD diff --from testdata/3 --repo testdir/to1 --password asdff --progress none --verbose 1 )
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/3 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress none --verbose 1 )
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ! ( echo "$OUT" | grep -q 'b is different' ) && ( echo "$OUT" | grep -q 'a is different' ) && ( echo "$OUT" | grep -q 'l is different' )\
|
if ! ( ! ( echo "$OUT" | grep -q 'b is different' ) && ( echo "$OUT" | grep -q 'a is different' ) && ( echo "$OUT" | grep -q 'l is different' )\
|
||||||
&& ! ( echo "$OUT" | grep -q 'aa is different' ) && ( echo "$OUT" | grep -q 'c is different' ) && ! ( echo "$OUT" | grep -q 'empty is different' ) && ! ( echo "$OUT" | grep -q 'notempty is different' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'aa is different' ) && ( echo "$OUT" | grep -q 'c is different' ) && ! ( echo "$OUT" | grep -q 'empty is different' ) && ! ( echo "$OUT" | grep -q 'notempty is different' ) ); then
|
||||||
@@ -204,13 +205,13 @@ fi
|
|||||||
echo "OK comparing archive last and current"
|
echo "OK comparing archive last and current"
|
||||||
|
|
||||||
|
|
||||||
if ! $CMD init --repo testdir/to2 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
if ! $CMD init --repo "$TESTDATADIR"/testdir/to2 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
||||||
echo "Error creating repo!"
|
echo "Error creating repo!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Repo created"
|
echo "Repo created"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied: aa' ) && ( echo "$OUT" | grep -q 'Copied: b' ) && ( echo "$OUT" | grep -q 'Copied: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied: aa' ) && ( echo "$OUT" | grep -q 'Copied: b' ) && ( echo "$OUT" | grep -q 'Copied: c' ) ); then
|
||||||
echo "Error backing up 1 dir!"
|
echo "Error backing up 1 dir!"
|
||||||
@@ -218,7 +219,7 @@ if ! ( ( echo "$OUT" | grep -q 'Copied: a' ) && ( echo "$OUT" | grep -q 'Copied:
|
|||||||
fi
|
fi
|
||||||
echo "Backup 1 ok"
|
echo "Backup 1 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' )); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' )); then
|
||||||
echo "Error backing up 2 dir!"
|
echo "Error backing up 2 dir!"
|
||||||
@@ -226,7 +227,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipp
|
|||||||
fi
|
fi
|
||||||
echo "Backup 2 ok"
|
echo "Backup 2 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 3 dir!"
|
echo "Error backing up 3 dir!"
|
||||||
@@ -234,7 +235,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipp
|
|||||||
fi
|
fi
|
||||||
echo "Backup 3 ok"
|
echo "Backup 3 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' )); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' )); then
|
||||||
echo "Error backing up 4 dir!"
|
echo "Error backing up 4 dir!"
|
||||||
@@ -242,7 +243,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skippe
|
|||||||
fi
|
fi
|
||||||
echo "Backup 4 ok"
|
echo "Backup 4 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 5 dir!"
|
echo "Error backing up 5 dir!"
|
||||||
@@ -250,7 +251,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipp
|
|||||||
fi
|
fi
|
||||||
echo "Backup 5 ok"
|
echo "Backup 5 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 6 dir!"
|
echo "Error backing up 6 dir!"
|
||||||
@@ -258,7 +259,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipp
|
|||||||
fi
|
fi
|
||||||
echo "Backup 6 ok"
|
echo "Backup 6 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 7 dir!"
|
echo "Error backing up 7 dir!"
|
||||||
@@ -266,7 +267,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipp
|
|||||||
fi
|
fi
|
||||||
echo "Backup 7 ok"
|
echo "Backup 7 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' )); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' )); then
|
||||||
echo "Error backing up 8 dir!"
|
echo "Error backing up 8 dir!"
|
||||||
@@ -274,7 +275,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skippe
|
|||||||
fi
|
fi
|
||||||
echo "Backup 8 ok"
|
echo "Backup 8 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 9 dir!"
|
echo "Error backing up 9 dir!"
|
||||||
@@ -282,7 +283,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipp
|
|||||||
fi
|
fi
|
||||||
echo "Backup 9 ok"
|
echo "Backup 9 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 10 dir!"
|
echo "Error backing up 10 dir!"
|
||||||
@@ -290,7 +291,7 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipp
|
|||||||
fi
|
fi
|
||||||
echo "Backup 10 ok"
|
echo "Backup 10 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to2 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to2 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skipped: aa' ) && ( echo "$OUT" | grep -q 'Skipped: b' ) && ( echo "$OUT" | grep -q 'Skipped: c' ) ); then
|
||||||
echo "Error backing up 11 dir!"
|
echo "Error backing up 11 dir!"
|
||||||
@@ -298,8 +299,6 @@ if ! ( ( echo "$OUT" | grep -q 'Skipped: a' ) && ( echo "$OUT" | grep -q 'Skippe
|
|||||||
fi
|
fi
|
||||||
echo "Backup 11 ok"
|
echo "Backup 11 ok"
|
||||||
|
|
||||||
rm -rf testdata
|
rm -rf "$TESTDATADIR"
|
||||||
rm -rf testdir
|
|
||||||
rm -rf testmount
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
@@ -3,70 +3,71 @@
|
|||||||
# TODO: Don't hardcode this
|
# TODO: Don't hardcode this
|
||||||
CMD="../../src/backup"
|
CMD="../../src/backup"
|
||||||
|
|
||||||
rm -rf testdata
|
TESTDATADIR=diff
|
||||||
rm -rf testdir
|
|
||||||
|
|
||||||
mkdir -p testdir
|
rm -rf "$TESTDATADIR"
|
||||||
mkdir -p testdata/1
|
|
||||||
mkdir -p testdata/1/empty
|
|
||||||
mkdir -p testdata/1/notempty
|
|
||||||
|
|
||||||
mkdir -p testdata/1/emptyi
|
mkdir -p "$TESTDATADIR"/testdir
|
||||||
mkdir -p testdata/1/notemptyi
|
mkdir -p "$TESTDATADIR"/testdata/1
|
||||||
|
mkdir -p "$TESTDATADIR"/testdata/1/empty
|
||||||
|
mkdir -p "$TESTDATADIR"/testdata/1/notempty
|
||||||
|
|
||||||
mkdir -p testdata/1/notempty2/empty
|
mkdir -p "$TESTDATADIR"/testdata/1/emptyi
|
||||||
mkdir -p testdata/1/notempty2/notemptyi2
|
mkdir -p "$TESTDATADIR"/testdata/1/notemptyi
|
||||||
mkdir -p testdata/1/notempty2/notemptyi2/ignoredir
|
|
||||||
|
|
||||||
echo "testtestasdf1" > testdata/1/notempty/testfile
|
mkdir -p "$TESTDATADIR"/testdata/1/notempty2/empty
|
||||||
echo "testtestasdf2" > testdata/1/notemptyi/testfile
|
mkdir -p "$TESTDATADIR"/testdata/1/notempty2/notemptyi2
|
||||||
echo "testtestasdf3" > testdata/1/notempty2/notempty
|
mkdir -p "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/ignoredir
|
||||||
echo "testtestasdf4" > testdata/1/notempty2/notemptyi2/test4
|
|
||||||
echo "testtestasdf5" > testdata/1/notempty2/notemptyi2/test5
|
|
||||||
echo "testtestasdf6" > testdata/1/notempty2/notemptyi2/test6
|
|
||||||
echo "testtestasdf7" > testdata/1/notempty2/notemptyi2/test7
|
|
||||||
echo "testtestasdf8" > testdata/1/notempty2/notemptyi2/ignoredir/testa
|
|
||||||
echo "testtestasdf9" > testdata/1/filexd
|
|
||||||
|
|
||||||
echo ".*4" > testdata/1/notempty2/.ignore
|
echo "testtestasdf1" > "$TESTDATADIR"/testdata/1/notempty/testfile
|
||||||
echo ".*5" > testdata/1/notempty2/notemptyi2/.ignore
|
echo "testtestasdf2" > "$TESTDATADIR"/testdata/1/notemptyi/testfile
|
||||||
touch testdata/1/notemptyi/.nobackup
|
echo "testtestasdf3" > "$TESTDATADIR"/testdata/1/notempty2/notempty
|
||||||
touch testdata/1/emptyi/.nobackup
|
echo "testtestasdf4" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/test4
|
||||||
touch testdata/1/notempty2/notemptyi2/ignoredir/.nobackup
|
echo "testtestasdf5" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/test5
|
||||||
|
echo "testtestasdf6" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/test6
|
||||||
|
echo "testtestasdf7" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/test7
|
||||||
|
echo "testtestasdf8" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/ignoredir/testa
|
||||||
|
echo "testtestasdf9" > "$TESTDATADIR"/testdata/1/filexd
|
||||||
|
|
||||||
cp -a -p testdata/1 testdata/2
|
echo ".*4" > "$TESTDATADIR"/testdata/1/notempty2/.ignore
|
||||||
echo "testtestasdf4u" > testdata/2/notempty2/notemptyi2/test4
|
echo ".*5" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/.ignore
|
||||||
echo "testtestasdf5u" > testdata/2/notempty2/notemptyi2/test5
|
touch "$TESTDATADIR"/testdata/1/notemptyi/.nobackup
|
||||||
echo "testtestasdf6u" > testdata/2/notempty2/notemptyi2/test6
|
touch "$TESTDATADIR"/testdata/1/emptyi/.nobackup
|
||||||
echo "testtestasdf7u" > testdata/2/notempty2/notemptyi2/test7
|
touch "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/ignoredir/.nobackup
|
||||||
echo "testtestasdf8u" > testdata/2/notempty2/notemptyi2/ignoredir/testa
|
|
||||||
echo "testtestasdf9u" > testdata/2/filexd
|
|
||||||
|
|
||||||
cp -a -p testdata/2 testdata/3
|
cp -a -p "$TESTDATADIR"/testdata/1 "$TESTDATADIR"/testdata/2
|
||||||
echo "testtestasdf4uu" > testdata/3/notempty2/notemptyi2/test4
|
echo "testtestasdf4u" > "$TESTDATADIR"/testdata/2/notempty2/notemptyi2/test4
|
||||||
echo "testtestasdf5uu" > testdata/3/notempty2/notemptyi2/test5
|
echo "testtestasdf5u" > "$TESTDATADIR"/testdata/2/notempty2/notemptyi2/test5
|
||||||
echo "testtestasdf6uu" > testdata/3/notempty2/notemptyi2/test6
|
echo "testtestasdf6u" > "$TESTDATADIR"/testdata/2/notempty2/notemptyi2/test6
|
||||||
echo "testtestasdf7uu" > testdata/3/notempty2/notemptyi2/test7
|
echo "testtestasdf7u" > "$TESTDATADIR"/testdata/2/notempty2/notemptyi2/test7
|
||||||
echo "testtestasdf8uu" > testdata/3/notempty2/notemptyi2/ignoredir/testa
|
echo "testtestasdf8u" > "$TESTDATADIR"/testdata/2/notempty2/notemptyi2/ignoredir/testa
|
||||||
echo "testtestasdf9uu" > testdata/3/filexd
|
echo "testtestasdf9u" > "$TESTDATADIR"/testdata/2/filexd
|
||||||
|
|
||||||
cp -a -p testdata/2 testdata/4
|
cp -a -p "$TESTDATADIR"/testdata/2 "$TESTDATADIR"/testdata/3
|
||||||
echo "testtestasdf4uuu" > testdata/4/notempty2/notemptyi2/test4
|
echo "testtestasdf4uu" > "$TESTDATADIR"/testdata/3/notempty2/notemptyi2/test4
|
||||||
echo "testtestasdf5uuu" > testdata/4/notempty2/notemptyi2/test5
|
echo "testtestasdf5uu" > "$TESTDATADIR"/testdata/3/notempty2/notemptyi2/test5
|
||||||
echo "testtestasdf6uuu" > testdata/4/notempty2/notemptyi2/test6
|
echo "testtestasdf6uu" > "$TESTDATADIR"/testdata/3/notempty2/notemptyi2/test6
|
||||||
echo "testtestasdf7uuu" > testdata/4/notempty2/notemptyi2/test7
|
echo "testtestasdf7uu" > "$TESTDATADIR"/testdata/3/notempty2/notemptyi2/test7
|
||||||
echo "testtestasdf8uuu" > testdata/4/notempty2/notemptyi2/ignoredir/testa
|
echo "testtestasdf8uu" > "$TESTDATADIR"/testdata/3/notempty2/notemptyi2/ignoredir/testa
|
||||||
echo "testtestasdf9uuu" > testdata/4/filexd
|
echo "testtestasdf9uu" > "$TESTDATADIR"/testdata/3/filexd
|
||||||
|
|
||||||
|
cp -a -p "$TESTDATADIR"/testdata/2 "$TESTDATADIR"/testdata/4
|
||||||
|
echo "testtestasdf4uuu" > "$TESTDATADIR"/testdata/4/notempty2/notemptyi2/test4
|
||||||
|
echo "testtestasdf5uuu" > "$TESTDATADIR"/testdata/4/notempty2/notemptyi2/test5
|
||||||
|
echo "testtestasdf6uuu" > "$TESTDATADIR"/testdata/4/notempty2/notemptyi2/test6
|
||||||
|
echo "testtestasdf7uuu" > "$TESTDATADIR"/testdata/4/notempty2/notemptyi2/test7
|
||||||
|
echo "testtestasdf8uuu" > "$TESTDATADIR"/testdata/4/notempty2/notemptyi2/ignoredir/testa
|
||||||
|
echo "testtestasdf9uuu" > "$TESTDATADIR"/testdata/4/filexd
|
||||||
|
|
||||||
echo "Data created"
|
echo "Data created"
|
||||||
|
|
||||||
if ! $CMD init --repo testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
if ! $CMD init --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
||||||
echo "Error creating repo!"
|
echo "Error creating repo!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Repo created"
|
echo "Repo created"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Copied: notempty/testfile' )\
|
if ! ( ( echo "$OUT" | grep -q 'Copied: notempty/testfile' )\
|
||||||
&& ( echo "$OUT" | grep -q 'Copied: notempty' )\
|
&& ( echo "$OUT" | grep -q 'Copied: notempty' )\
|
||||||
@@ -86,7 +87,7 @@ if ! ( ( echo "$OUT" | grep -q 'Copied: notempty/testfile' )\
|
|||||||
fi
|
fi
|
||||||
echo "Backup 1 ok"
|
echo "Backup 1 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/2 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/2 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4 ' )\
|
if ! ( ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4 ' )\
|
||||||
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5 ' )\
|
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5 ' )\
|
||||||
@@ -99,7 +100,7 @@ if ! ( ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4 ' )\
|
|||||||
fi
|
fi
|
||||||
echo "Backup 2 ok"
|
echo "Backup 2 ok"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/3 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/3 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4 ' )\
|
if ! ( ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4 ' )\
|
||||||
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5 ' )\
|
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5 ' )\
|
||||||
@@ -115,7 +116,7 @@ echo "Backup 3 ok"
|
|||||||
|
|
||||||
i=$((0))
|
i=$((0))
|
||||||
AIDS=()
|
AIDS=()
|
||||||
OUT=$($CMD list --repo testdir/to1 --password asdff)
|
OUT=$($CMD list --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
while IFS= read -r l; do
|
while IFS= read -r l; do
|
||||||
((i++))
|
((i++))
|
||||||
@@ -123,7 +124,7 @@ while IFS= read -r l; do
|
|||||||
AIDS+=("$aid")
|
AIDS+=("$aid")
|
||||||
done <<< "$OUT"
|
done <<< "$OUT"
|
||||||
|
|
||||||
OUT=$($CMD diff --from testdata/4 --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[0]} --aid2 ${AIDS[1]})
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[0]} --aid2 ${AIDS[1]})
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
||||||
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
||||||
@@ -131,7 +132,7 @@ if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && (
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "OK comparing archive 1 and 2"
|
echo "OK comparing archive 1 and 2"
|
||||||
OUT=$($CMD diff --from testdata/4 --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[1]} --aid2 ${AIDS[2]})
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
||||||
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
||||||
@@ -140,7 +141,7 @@ if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && (
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive 2 and 3"
|
echo "OK comparing archive 2 and 3"
|
||||||
|
|
||||||
OUT=$($CMD diff --from testdata/4 --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]})
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]})
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
||||||
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
||||||
@@ -149,7 +150,7 @@ if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && (
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive 3 and current"
|
echo "OK comparing archive 3 and current"
|
||||||
|
|
||||||
OUT=$($CMD diff --from testdata/4 --repo testdir/to1 --password asdff --progress none --verbose 1 )
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 )
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
||||||
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
||||||
@@ -158,7 +159,7 @@ if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && (
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive last (3) and current"
|
echo "OK comparing archive last (3) and current"
|
||||||
|
|
||||||
OUT=$($CMD diff --from testdata/4 --repo testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]} --prefix notempty2/notemptyi2 )
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --aid ${AIDS[2]} --prefix notempty2/notemptyi2 )
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ! ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ! ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
||||||
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
||||||
@@ -167,7 +168,7 @@ if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && !
|
|||||||
fi
|
fi
|
||||||
echo "OK comparing archive 3 and current with prefix "
|
echo "OK comparing archive 3 and current with prefix "
|
||||||
|
|
||||||
OUT=$($CMD diff --from testdata/4 --repo testdir/to1 --password asdff --progress none --verbose 1 --prefix notempty2/notemptyi2 )
|
OUT=$($CMD diff --from "$TESTDATADIR"/testdata/4 --repo "$"$TESTDATADIR"/testdataDIR"/testdir/to1 --password asdff --progress none --verbose 1 --prefix notempty2/notemptyi2 )
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ! ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
if ! ( ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test6 is different' ) && ! ( echo "$OUT" | grep -q 'filexd is different' ) && ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test7 is different' ) \
|
||||||
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
&& ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test4' ) && ! ( echo "$OUT" | grep -q 'notempty2/notemptyi2/test5' ) && ! ( echo "$OUT" | grep -q 'notemptyi2/ignoredir/testa' ) ); then
|
||||||
@@ -177,7 +178,6 @@ fi
|
|||||||
echo "OK comparing archive last (3) and current with prefix "
|
echo "OK comparing archive last (3) and current with prefix "
|
||||||
|
|
||||||
|
|
||||||
rm -rf testdata
|
rm -rf "$"$TESTDATADIR"/testdataDIR"
|
||||||
rm -rf testdir
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
@@ -3,42 +3,43 @@
|
|||||||
# TODO: Don't hardcode this
|
# TODO: Don't hardcode this
|
||||||
CMD="../../src/backup"
|
CMD="../../src/backup"
|
||||||
|
|
||||||
rm -rf testdata
|
TESTDATADIR=ignore
|
||||||
rm -rf testdir
|
|
||||||
|
|
||||||
mkdir -p testdir
|
rm -rf "$TESTDATADIR"
|
||||||
mkdir -p testdata/1
|
|
||||||
mkdir -p testdata/1/empty
|
|
||||||
mkdir -p testdata/1/notempty
|
|
||||||
|
|
||||||
mkdir -p testdata/1/emptyi
|
mkdir -p "$TESTDATADIR"/testdir
|
||||||
mkdir -p testdata/1/notemptyi
|
mkdir -p "$TESTDATADIR"/testdata/1
|
||||||
|
mkdir -p "$TESTDATADIR"/testdata/1/empty
|
||||||
|
mkdir -p "$TESTDATADIR"/testdata/1/notempty
|
||||||
|
|
||||||
mkdir -p testdata/1/notempty2/empty
|
mkdir -p "$TESTDATADIR"/testdata/1/emptyi
|
||||||
mkdir -p testdata/1/notempty2/notemptyi2
|
mkdir -p "$TESTDATADIR"/testdata/1/notemptyi
|
||||||
|
|
||||||
echo "testtestasdf1" > testdata/1/notempty/testfile
|
mkdir -p "$TESTDATADIR"/testdata/1/notempty2/empty
|
||||||
echo "testtestasdf2" > testdata/1/notemptyi/testfile
|
mkdir -p "$TESTDATADIR"/testdata/1/notempty2/notemptyi2
|
||||||
echo "testtestasdf3" > testdata/1/notempty2/notempty
|
|
||||||
echo "testtestasdf4" > testdata/1/notempty2/notemptyi2/test4
|
|
||||||
echo "testtestasdf5" > testdata/1/notempty2/notemptyi2/test5
|
|
||||||
echo "testtestasdf6" > testdata/1/notempty2/notemptyi2/test6
|
|
||||||
echo "testtestasdf7" > testdata/1/notempty2/notemptyi2/test7
|
|
||||||
|
|
||||||
echo ".*4" > testdata/1/notempty2/.ignore
|
echo "testtestasdf1" > "$TESTDATADIR"/testdata/1/notempty/testfile
|
||||||
echo ".*5" > testdata/1/notempty2/notemptyi2/.ignore
|
echo "testtestasdf2" > "$TESTDATADIR"/testdata/1/notemptyi/testfile
|
||||||
touch testdata/1/notemptyi/.nobackup
|
echo "testtestasdf3" > "$TESTDATADIR"/testdata/1/notempty2/notempty
|
||||||
touch testdata/1/emptyi/.nobackup
|
echo "testtestasdf4" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/test4
|
||||||
|
echo "testtestasdf5" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/test5
|
||||||
|
echo "testtestasdf6" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/test6
|
||||||
|
echo "testtestasdf7" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/test7
|
||||||
|
|
||||||
|
echo ".*4" > "$TESTDATADIR"/testdata/1/notempty2/.ignore
|
||||||
|
echo ".*5" > "$TESTDATADIR"/testdata/1/notempty2/notemptyi2/.ignore
|
||||||
|
touch "$TESTDATADIR"/testdata/1/notemptyi/.nobackup
|
||||||
|
touch "$TESTDATADIR"/testdata/1/emptyi/.nobackup
|
||||||
|
|
||||||
echo "Data created"
|
echo "Data created"
|
||||||
|
|
||||||
if ! $CMD init --repo testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
if ! $CMD init --repo "$TESTDATADIR"/testdir/to1 --compression zlib --compression-level 4 --encryption aes --password asdff --salt e; then
|
||||||
echo "Error creating repo!"
|
echo "Error creating repo!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Repo created"
|
echo "Repo created"
|
||||||
|
|
||||||
OUT=$($CMD run --from testdata/1 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD run --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q 'Copied: notempty/testfile' )\
|
if ! ( ( echo "$OUT" | grep -q 'Copied: notempty/testfile' )\
|
||||||
&& ( echo "$OUT" | grep -q 'Copied: notempty' )\
|
&& ( echo "$OUT" | grep -q 'Copied: notempty' )\
|
||||||
@@ -58,7 +59,7 @@ echo "Backup 1 ok"
|
|||||||
|
|
||||||
i=$((0))
|
i=$((0))
|
||||||
AIDS=()
|
AIDS=()
|
||||||
OUT=$($CMD list --repo testdir/to1 --password asdff)
|
OUT=$($CMD list --repo "$TESTDATADIR"/testdir/to1 --password asdff)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
while IFS= read -r l; do
|
while IFS= read -r l; do
|
||||||
((i++))
|
((i++))
|
||||||
@@ -66,7 +67,7 @@ while IFS= read -r l; do
|
|||||||
AIDS+=("$aid")
|
AIDS+=("$aid")
|
||||||
done <<< "$OUT"
|
done <<< "$OUT"
|
||||||
|
|
||||||
OUT=$($CMD list-files --aid ${AIDS[0]} --from testdata/1 --repo testdir/to1 --password asdff --progress simple --verbose 1)
|
OUT=$($CMD list-files --aid ${AIDS[0]} --from "$TESTDATADIR"/testdata/1 --repo "$TESTDATADIR"/testdir/to1 --password asdff --progress simple --verbose 1)
|
||||||
echo "$OUT"
|
echo "$OUT"
|
||||||
if ! ( ( echo "$OUT" | grep -q ' notempty/testfile' )\
|
if ! ( ( echo "$OUT" | grep -q ' notempty/testfile' )\
|
||||||
&& ( echo "$OUT" | grep -q ' notempty' )\
|
&& ( echo "$OUT" | grep -q ' notempty' )\
|
||||||
@@ -84,7 +85,6 @@ if ! ( ( echo "$OUT" | grep -q ' notempty/testfile' )\
|
|||||||
fi
|
fi
|
||||||
echo "List 1 ok"
|
echo "List 1 ok"
|
||||||
|
|
||||||
rm -rf testdata
|
rm -rf "$"$TESTDATADIR"/testdataDIR"
|
||||||
rm -rf testdir
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
@@ -22,18 +22,18 @@ void randomChange(std::string path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(FullTest, Simple) {
|
TEST(FullTest, Simple) {
|
||||||
Cleaner c({"testfrom", "testto", "testtores"});
|
Cleaner c({"Simple/testfrom", "Simple/testto", "Simple/testtores"});
|
||||||
int aid = -1;
|
int aid = -1;
|
||||||
{
|
{
|
||||||
std::filesystem::create_directories("testfrom");
|
std::filesystem::create_directories("Simple/testfrom");
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 257; i++) {
|
||||||
std::ofstream o(std::filesystem::path("testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
std::ofstream o(std::filesystem::path("Simple/testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
||||||
for (int j = 0; j < i; j++) o.put(static_cast<char>(j % 256));
|
for (int j = 0; j < i; j++) o.put(static_cast<char>(j % 256));
|
||||||
}
|
}
|
||||||
std::filesystem::create_directories("testfrom/testdir");
|
std::filesystem::create_directories("Simple/testfrom/testdir");
|
||||||
|
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto").add("from", "testfrom");
|
conf.add("repo", "Simple/testto").add("from", "Simple/testfrom");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(conf);
|
auto repo = std::make_unique<FileRepository>(conf);
|
||||||
repo->init();
|
repo->init();
|
||||||
@@ -48,7 +48,7 @@ TEST(FullTest, Simple) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto").add("aid", std::to_string(aid)).add("to", "testtores");
|
conf.add("repo", "Simple/testto").add("aid", std::to_string(aid)).add("to", "Simple/testtores");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(conf);
|
auto repo = std::make_unique<FileRepository>(conf);
|
||||||
repo->open();
|
repo->open();
|
||||||
@@ -60,14 +60,14 @@ TEST(FullTest, Simple) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
EXPECT_EQ(std::filesystem::is_directory("testtores/testdir"), true);
|
EXPECT_EQ(std::filesystem::is_directory("Simple/testtores/testdir"), true);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
std::cerr << "Empty directory doesn't exist!" << std::endl;
|
std::cerr << "Empty directory doesn't exist!" << std::endl;
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 257; i++) {
|
||||||
std::ifstream o(std::filesystem::path("testtores") / ("f" + std::to_string(i)), std::ios::binary | std::ios::in);
|
std::ifstream o(std::filesystem::path("Simple/testtores") / ("f" + std::to_string(i)), std::ios::binary | std::ios::in);
|
||||||
try {
|
try {
|
||||||
EXPECT_EQ(o.is_open(), true);
|
EXPECT_EQ(o.is_open(), true);
|
||||||
for (int j = 0; j < i; j++) {
|
for (int j = 0; j < i; j++) {
|
||||||
@@ -84,44 +84,44 @@ TEST(FullTest, Simple) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(FullTest, SimpleWithIgnore) {
|
TEST(FullTest, SimpleWithIgnore) {
|
||||||
Cleaner c({"testfrom", "testto", "testtores"});
|
Cleaner c({"SimpleWithIgnore/testfrom", "SimpleWithIgnore/testto", "SimpleWithIgnore/testtores"});
|
||||||
int aid = -1;
|
int aid = -1;
|
||||||
{
|
{
|
||||||
std::filesystem::create_directories("testfrom");
|
std::filesystem::create_directories("SimpleWithIgnore/testfrom");
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 257; i++) {
|
||||||
std::ofstream o(std::filesystem::path("testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
std::ofstream o(std::filesystem::path("SimpleWithIgnore/testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
||||||
for (int j = 0; j < i; j++) o.put(static_cast<char>(j % 256));
|
for (int j = 0; j < i; j++) o.put(static_cast<char>(j % 256));
|
||||||
}
|
}
|
||||||
std::filesystem::create_directories("testfrom/testdir");
|
std::filesystem::create_directories("SimpleWithIgnore/testfrom/testdir");
|
||||||
std::filesystem::create_directories("testfrom/testdir2/testdir3");
|
std::filesystem::create_directories("SimpleWithIgnore/testfrom/testdir2/testdir3");
|
||||||
std::filesystem::create_directories("testfrom/testdir2/testdir4");
|
std::filesystem::create_directories("SimpleWithIgnore/testfrom/testdir2/testdir4");
|
||||||
{
|
{
|
||||||
std::ofstream file("testfrom/testdir2/.ignore");
|
std::ofstream file("SimpleWithIgnore/testfrom/testdir2/.ignore");
|
||||||
file << "hello.txt";
|
file << "hello.txt";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ofstream file("testfrom/testdir2/testdir3/.ignore");
|
std::ofstream file("SimpleWithIgnore/testfrom/testdir2/testdir3/.ignore");
|
||||||
file << ".*\\.txt";
|
file << ".*\\.txt";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ofstream file("testfrom/testdir2/hello.txt");
|
std::ofstream file("SimpleWithIgnore/testfrom/testdir2/hello.txt");
|
||||||
file << "hello";
|
file << "hello";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ofstream file("testfrom/testdir2/testdir3/hello.txt");
|
std::ofstream file("SimpleWithIgnore/testfrom/testdir2/testdir3/hello.txt");
|
||||||
file << "hello2";
|
file << "hello2";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ofstream file("testfrom/testdir2/testdir3/asdf.txt");
|
std::ofstream file("SimpleWithIgnore/testfrom/testdir2/testdir3/asdf.txt");
|
||||||
file << "asdf1";
|
file << "asdf1";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ofstream file("testfrom/testdir2/testdir4/asdf.txt");
|
std::ofstream file("SimpleWithIgnore/testfrom/testdir2/testdir4/asdf.txt");
|
||||||
file << "asdf2";
|
file << "asdf2";
|
||||||
}
|
}
|
||||||
|
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto").add("from", "testfrom");
|
conf.add("repo", "SimpleWithIgnore/testto").add("from", "SimpleWithIgnore/testfrom");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(conf);
|
auto repo = std::make_unique<FileRepository>(conf);
|
||||||
repo->init();
|
repo->init();
|
||||||
@@ -134,7 +134,7 @@ TEST(FullTest, SimpleWithIgnore) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto").add("aid", std::to_string(aid)).add("to", "testtores");
|
conf.add("repo", "SimpleWithIgnore/testto").add("aid", std::to_string(aid)).add("to", "SimpleWithIgnore/testtores");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(conf);
|
auto repo = std::make_unique<FileRepository>(conf);
|
||||||
repo->open();
|
repo->open();
|
||||||
@@ -145,10 +145,10 @@ TEST(FullTest, SimpleWithIgnore) {
|
|||||||
cmd.run(Context{&logger, repo.get()});
|
cmd.run(Context{&logger, repo.get()});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
EXPECT_EQ(std::filesystem::is_directory("testtores/testdir"), true);
|
EXPECT_EQ(std::filesystem::is_directory("SimpleWithIgnore/testtores/testdir"), true);
|
||||||
|
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 257; i++) {
|
||||||
std::ifstream o(std::filesystem::path("testtores") / ("f" + std::to_string(i)), std::ios::binary | std::ios::in);
|
std::ifstream o(std::filesystem::path("SimpleWithIgnore/testtores") / ("f" + std::to_string(i)), std::ios::binary | std::ios::in);
|
||||||
EXPECT_EQ(o.is_open(), true);
|
EXPECT_EQ(o.is_open(), true);
|
||||||
for (int j = 0; j < i; j++) {
|
for (int j = 0; j < i; j++) {
|
||||||
char c;
|
char c;
|
||||||
@@ -158,31 +158,31 @@ TEST(FullTest, SimpleWithIgnore) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
std::ifstream file("testtores/testdir2/.ignore");
|
std::ifstream file("SimpleWithIgnore/testtores/testdir2/.ignore");
|
||||||
std::string s;
|
std::string s;
|
||||||
file >> s;
|
file >> s;
|
||||||
EXPECT_EQ(s, "hello.txt");
|
EXPECT_EQ(s, "hello.txt");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ifstream file("testtores/testdir2/testdir3/.ignore");
|
std::ifstream file("SimpleWithIgnore/testtores/testdir2/testdir3/.ignore");
|
||||||
std::string s;
|
std::string s;
|
||||||
file >> s;
|
file >> s;
|
||||||
EXPECT_EQ(s, ".*\\.txt");
|
EXPECT_EQ(s, ".*\\.txt");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ifstream file("testtores/testdir2/hello.txt");
|
std::ifstream file("SimpleWithIgnore/testtores/testdir2/hello.txt");
|
||||||
EXPECT_EQ(!file, true);
|
EXPECT_EQ(!file, true);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ifstream file("testtores/testdir2/testdir3/hello.txt");
|
std::ifstream file("SimpleWithIgnore/testtores/testdir2/testdir3/hello.txt");
|
||||||
EXPECT_EQ(!file, true);
|
EXPECT_EQ(!file, true);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ifstream file("testtores/testdir2/testdir3/asdf.txt");
|
std::ifstream file("SimpleWithIgnore/testtores/testdir2/testdir3/asdf.txt");
|
||||||
EXPECT_EQ(!file, true);
|
EXPECT_EQ(!file, true);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ifstream file("testtores/testdir2/testdir4/asdf.txt");
|
std::ifstream file("SimpleWithIgnore/testtores/testdir2/testdir4/asdf.txt");
|
||||||
std::string s;
|
std::string s;
|
||||||
file >> s;
|
file >> s;
|
||||||
EXPECT_EQ(s, "asdf2");
|
EXPECT_EQ(s, "asdf2");
|
||||||
@@ -191,18 +191,18 @@ TEST(FullTest, SimpleWithIgnore) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(FullTest, SimpleWithCompress) {
|
TEST(FullTest, SimpleWithCompress) {
|
||||||
Cleaner c({"testfrom", "testto", "testtores"});
|
Cleaner c({"SimpleWithCompress/testfrom", "SimpleWithCompress/testto", "SimpleWithCompress/testtores"});
|
||||||
int aid = -1;
|
int aid = -1;
|
||||||
{
|
{
|
||||||
std::filesystem::create_directories("testfrom");
|
std::filesystem::create_directories("SimpleWithCompress/testfrom");
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 257; i++) {
|
||||||
std::ofstream o(std::filesystem::path("testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
std::ofstream o(std::filesystem::path("SimpleWithCompress/testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
||||||
for (int j = 0; j < i; j++) o.put(static_cast<char>(j % 256));
|
for (int j = 0; j < i; j++) o.put(static_cast<char>(j % 256));
|
||||||
}
|
}
|
||||||
std::filesystem::create_directories("testfrom/testdir");
|
std::filesystem::create_directories("SimpleWithCompress/testfrom/testdir");
|
||||||
|
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto").add("compression", "zlib").add("from", "testfrom");
|
conf.add("repo", "SimpleWithCompress/testto").add("compression", "zlib").add("from", "SimpleWithCompress/testfrom");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(conf);
|
auto repo = std::make_unique<FileRepository>(conf);
|
||||||
repo->init();
|
repo->init();
|
||||||
@@ -215,7 +215,7 @@ TEST(FullTest, SimpleWithCompress) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto").add("aid", std::to_string(aid)).add("to", "testtores");
|
conf.add("repo", "SimpleWithCompress/testto").add("aid", std::to_string(aid)).add("to", "SimpleWithCompress/testtores");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(conf);
|
auto repo = std::make_unique<FileRepository>(conf);
|
||||||
repo->open();
|
repo->open();
|
||||||
@@ -226,10 +226,10 @@ TEST(FullTest, SimpleWithCompress) {
|
|||||||
cmd.run(Context{&logger, repo.get()});
|
cmd.run(Context{&logger, repo.get()});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
EXPECT_EQ(std::filesystem::is_directory("testtores/testdir"), true);
|
EXPECT_EQ(std::filesystem::is_directory("SimpleWithCompress/testtores/testdir"), true);
|
||||||
|
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 257; i++) {
|
||||||
std::ifstream o(std::filesystem::path("testtores") / ("f" + std::to_string(i)), std::ios::binary | std::ios::in);
|
std::ifstream o(std::filesystem::path("SimpleWithCompress/testtores") / ("f" + std::to_string(i)), std::ios::binary | std::ios::in);
|
||||||
EXPECT_EQ(o.is_open(), true);
|
EXPECT_EQ(o.is_open(), true);
|
||||||
for (int j = 0; j < i; j++) {
|
for (int j = 0; j < i; j++) {
|
||||||
char c;
|
char c;
|
||||||
@@ -241,18 +241,18 @@ TEST(FullTest, SimpleWithCompress) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(FullTest, SimpleWithCompEnd) {
|
TEST(FullTest, SimpleWithCompEnd) {
|
||||||
Cleaner c({"testfrom", "testto", "testtores"});
|
Cleaner c({"SimpleWithCompEnd/testfrom", "SimpleWithCompEnd/testto", "SimpleWithCompEnd/testtores"});
|
||||||
int aid = -1;
|
int aid = -1;
|
||||||
{
|
{
|
||||||
std::filesystem::create_directories("testfrom");
|
std::filesystem::create_directories("SimpleWithCompEnd/testfrom");
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 257; i++) {
|
||||||
std::ofstream o(std::filesystem::path("testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
std::ofstream o(std::filesystem::path("SimpleWithCompEnd/testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
||||||
for (int j = 0; j < i; j++) o.put(static_cast<char>(j % 256));
|
for (int j = 0; j < i; j++) o.put(static_cast<char>(j % 256));
|
||||||
}
|
}
|
||||||
std::filesystem::create_directories("testfrom/testdir");
|
std::filesystem::create_directories("SimpleWithCompEnd/testfrom/testdir");
|
||||||
|
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto").add("compression", "zlib").add("from", "testfrom").add("encryption", "aes").add("password", "testp").add("salt", "tests");
|
conf.add("repo", "SimpleWithCompEnd/testto").add("compression", "zlib").add("from", "SimpleWithCompEnd/testfrom").add("encryption", "aes").add("password", "testp").add("salt", "tests");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(conf);
|
auto repo = std::make_unique<FileRepository>(conf);
|
||||||
repo->init();
|
repo->init();
|
||||||
@@ -266,7 +266,7 @@ TEST(FullTest, SimpleWithCompEnd) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto");
|
conf.add("repo", "SimpleWithCompEnd/testto");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(conf);
|
auto repo = std::make_unique<FileRepository>(conf);
|
||||||
|
|
||||||
@@ -279,7 +279,7 @@ TEST(FullTest, SimpleWithCompEnd) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto").add("password", "testp").add("aid", std::to_string(aid)).add("to", "testtores");
|
conf.add("repo", "SimpleWithCompEnd/testto").add("password", "testp").add("aid", std::to_string(aid)).add("to", "SimpleWithCompEnd/testtores");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(conf);
|
auto repo = std::make_unique<FileRepository>(conf);
|
||||||
repo->open();
|
repo->open();
|
||||||
@@ -291,10 +291,10 @@ TEST(FullTest, SimpleWithCompEnd) {
|
|||||||
cmd.run(Context{&logger, repo.get()});
|
cmd.run(Context{&logger, repo.get()});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
EXPECT_EQ(std::filesystem::is_directory("testtores/testdir"), true);
|
EXPECT_EQ(std::filesystem::is_directory("SimpleWithCompEnd/testtores/testdir"), true);
|
||||||
|
|
||||||
for (int i = 0; i < 257; i++) {
|
for (int i = 0; i < 257; i++) {
|
||||||
std::ifstream o(std::filesystem::path("testtores") / ("f" + std::to_string(i)), std::ios::binary | std::ios::in);
|
std::ifstream o(std::filesystem::path("SimpleWithCompEnd/testtores") / ("f" + std::to_string(i)), std::ios::binary | std::ios::in);
|
||||||
EXPECT_EQ(o.is_open(), true);
|
EXPECT_EQ(o.is_open(), true);
|
||||||
for (int j = 0; j < i; j++) {
|
for (int j = 0; j < i; j++) {
|
||||||
char c;
|
char c;
|
||||||
@@ -310,29 +310,29 @@ TEST(FullTest, Fuzz) {
|
|||||||
srand(time(nullptr));
|
srand(time(nullptr));
|
||||||
std::vector<Config> confs;
|
std::vector<Config> confs;
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testto").add("compression", "none").add("from", "testfrom").add("encryption", "none").add("password", "testp").add("salt", "tests").add("progress", "none");
|
conf.add("repo", "Fuzz/testto").add("compression", "none").add("from", "Fuzz/testfrom").add("encryption", "none").add("password", "testp").add("salt", "tests").add("progress", "none");
|
||||||
confs.emplace_back(conf);
|
confs.emplace_back(conf);
|
||||||
conf = Config();
|
conf = Config();
|
||||||
conf.add("repo", "testto").add("compression", "zlib").add("from", "testfrom").add("encryption", "none").add("password", "testp").add("salt", "tests").add("progress", "none");
|
conf.add("repo", "Fuzz/testto").add("compression", "zlib").add("from", "Fuzz/testfrom").add("encryption", "none").add("password", "testp").add("salt", "tests").add("progress", "none");
|
||||||
confs.emplace_back(conf);
|
confs.emplace_back(conf);
|
||||||
conf = Config();
|
conf = Config();
|
||||||
conf.add("repo", "testto").add("compression", "none").add("from", "testfrom").add("encryption", "zlib").add("password", "testp").add("salt", "tests").add("progress", "none");
|
conf.add("repo", "Fuzz/testto").add("compression", "none").add("from", "Fuzz/testfrom").add("encryption", "zlib").add("password", "testp").add("salt", "tests").add("progress", "none");
|
||||||
confs.emplace_back(conf);
|
confs.emplace_back(conf);
|
||||||
conf = Config();
|
conf = Config();
|
||||||
conf.add("repo", "testto").add("compression", "zlib").add("from", "testfrom").add("encryption", "aes").add("password", "testp").add("salt", "tests").add("progress", "none");
|
conf.add("repo", "Fuzz/testto").add("compression", "zlib").add("from", "Fuzz/testfrom").add("encryption", "aes").add("password", "testp").add("salt", "tests").add("progress", "none");
|
||||||
confs.emplace_back(conf);
|
confs.emplace_back(conf);
|
||||||
|
|
||||||
for (auto const &conf: confs) {
|
for (auto const &conf: confs) {
|
||||||
for (uint8_t filetobreak = 1; filetobreak <= 15; filetobreak++) {
|
for (uint8_t filetobreak = 1; filetobreak <= 15; filetobreak++) {
|
||||||
std::cout << static_cast<int>(filetobreak) << " / 15 tests done" << std::endl;
|
std::cout << static_cast<int>(filetobreak) << " / 15 tests done" << std::endl;
|
||||||
for (uint8_t cutoff = 1; cutoff < 20; cutoff++) {
|
for (uint8_t cutoff = 1; cutoff < 20; cutoff++) {
|
||||||
Cleaner c({"testfrom", "testto", "testtores"});
|
Cleaner c({"Fuzz/testfrom", "Fuzz/testto", "Fuzz/testtores"});
|
||||||
|
|
||||||
int aid = -1;
|
int aid = -1;
|
||||||
{
|
{
|
||||||
std::filesystem::create_directories("testfrom");
|
std::filesystem::create_directories("Fuzz/testfrom");
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
std::ofstream o(std::filesystem::path("testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
std::ofstream o(std::filesystem::path("Fuzz/testfrom") / ("f" + std::to_string(i)), std::ios::binary | std::ios::out | std::ios::trunc);
|
||||||
for (int j = 0; j < i; j++) o.put(j % 2);
|
for (int j = 0; j < i; j++) o.put(j % 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,27 +351,27 @@ TEST(FullTest, Fuzz) {
|
|||||||
{
|
{
|
||||||
if (filetobreak & 0b00000001) {
|
if (filetobreak & 0b00000001) {
|
||||||
for (int i = 0; i < cutoff; i++)
|
for (int i = 0; i < cutoff; i++)
|
||||||
randomChange("testto/1");
|
randomChange("Fuzz/testto/1");
|
||||||
if (cutoff > 5)
|
if (cutoff > 5)
|
||||||
std::filesystem::resize_file("testto/1", std::filesystem::file_size("testto/1") - cutoff);
|
std::filesystem::resize_file("Fuzz/testto/1", std::filesystem::file_size("Fuzz/testto/1") - cutoff);
|
||||||
}
|
}
|
||||||
if (filetobreak & 0b00000010) {
|
if (filetobreak & 0b00000010) {
|
||||||
for (int i = 0; i < cutoff; i++)
|
for (int i = 0; i < cutoff; i++)
|
||||||
randomChange("testto/index");
|
randomChange("Fuzz/testto/index");
|
||||||
if (cutoff > 5)
|
if (cutoff > 5)
|
||||||
std::filesystem::resize_file("testto/index", std::filesystem::file_size("testto/index") - cutoff);
|
std::filesystem::resize_file("Fuzz/testto/index", std::filesystem::file_size("Fuzz/testto/index") - cutoff);
|
||||||
}
|
}
|
||||||
if (filetobreak & 0b00000100) {
|
if (filetobreak & 0b00000100) {
|
||||||
for (int i = 0; i < cutoff; i++)
|
for (int i = 0; i < cutoff; i++)
|
||||||
randomChange("testto/offsets");
|
randomChange("Fuzz/testto/offsets");
|
||||||
if (cutoff > 5)
|
if (cutoff > 5)
|
||||||
std::filesystem::resize_file("testto/offsets", std::filesystem::file_size("testto/offsets") - cutoff);
|
std::filesystem::resize_file("Fuzz/testto/offsets", std::filesystem::file_size("Fuzz/testto/offsets") - cutoff);
|
||||||
}
|
}
|
||||||
if (filetobreak & 0b00001000) {
|
if (filetobreak & 0b00001000) {
|
||||||
for (int i = 0; i < cutoff; i++)
|
for (int i = 0; i < cutoff; i++)
|
||||||
randomChange("testto/info");
|
randomChange("Fuzz/testto/info");
|
||||||
if (cutoff > 5)
|
if (cutoff > 5)
|
||||||
std::filesystem::resize_file("testto/info", std::filesystem::file_size("testto/info") - cutoff);
|
std::filesystem::resize_file("Fuzz/testto/info", std::filesystem::file_size("Fuzz/testto/info") - cutoff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ TEST(FullTest, Fuzz) {
|
|||||||
bool ok = true;
|
bool ok = true;
|
||||||
try {
|
try {
|
||||||
Config confr = conf;
|
Config confr = conf;
|
||||||
confr.add("aid", std::to_string(aid)).add("to", "testtores");
|
confr.add("aid", std::to_string(aid)).add("to", "Fuzz/testtores");
|
||||||
|
|
||||||
auto repo = std::make_unique<FileRepository>(confr);
|
auto repo = std::make_unique<FileRepository>(confr);
|
||||||
repo->open();
|
repo->open();
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
#include "objects/Chunk.h"
|
#include "objects/Chunk.h"
|
||||||
|
|
||||||
TEST(FileRepository, Deserialize) {
|
TEST(FileRepository, Deserialize) {
|
||||||
Cleaner c({"testrepo"});
|
Cleaner c({"Deserizlize/testrepo"});
|
||||||
|
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testrepo");
|
conf.add("repo", "Deserizlize/testrepo");
|
||||||
FileRepository repo(conf);
|
FileRepository repo(conf);
|
||||||
repo.init();
|
repo.init();
|
||||||
std::vector<char>
|
std::vector<char>
|
||||||
@@ -38,7 +38,7 @@ TEST(FileRepository, Deserialize) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testrepo");
|
conf.add("repo", "Deserizlize/testrepo");
|
||||||
FileRepository repo(conf);
|
FileRepository repo(conf);
|
||||||
repo.open();
|
repo.open();
|
||||||
|
|
||||||
@@ -82,11 +82,11 @@ TEST(FileRepository, Deserialize) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(FileRepository, Filters) {
|
TEST(FileRepository, Filters) {
|
||||||
Cleaner c({"testrepo"});
|
Cleaner c({"Filters/testrepo"});
|
||||||
|
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testrepo")
|
conf.add("repo", "Filters/testrepo")
|
||||||
.add("compression", "shiftC")
|
.add("compression", "shiftC")
|
||||||
.add("compression-level", "1")
|
.add("compression-level", "1")
|
||||||
.add("encryption", "shiftE")
|
.add("encryption", "shiftE")
|
||||||
@@ -114,7 +114,7 @@ TEST(FileRepository, Filters) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testrepo")
|
conf.add("repo", "Filters/testrepo")
|
||||||
.add("compression", "shiftC")
|
.add("compression", "shiftC")
|
||||||
.add("compression-level", "1")
|
.add("compression-level", "1")
|
||||||
.add("encryption", "shiftE")
|
.add("encryption", "shiftE")
|
||||||
@@ -152,7 +152,7 @@ TEST(FileRepository, Filters) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testrepo")
|
conf.add("repo", "Filters/testrepo")
|
||||||
.add("compression", "shiftC")
|
.add("compression", "shiftC")
|
||||||
.add("compression-level", "1")
|
.add("compression-level", "1")
|
||||||
.add("encryption", "shiftE")
|
.add("encryption", "shiftE")
|
||||||
@@ -204,10 +204,10 @@ TEST(FileRepository, Filters) {
|
|||||||
|
|
||||||
TEST(FileRepository, IDsDisabled) {
|
TEST(FileRepository, IDsDisabled) {
|
||||||
GTEST_SKIP();
|
GTEST_SKIP();
|
||||||
Cleaner c({"testrepo"});
|
Cleaner c({"IDS/testrepo"});
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testrepo");
|
conf.add("repo", "IDS/testrepo");
|
||||||
FileRepository repo(conf);
|
FileRepository repo(conf);
|
||||||
repo.init();
|
repo.init();
|
||||||
|
|
||||||
@@ -233,7 +233,7 @@ TEST(FileRepository, IDsDisabled) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testrepo");
|
conf.add("repo", "IDS/testrepo");
|
||||||
FileRepository repo(conf);
|
FileRepository repo(conf);
|
||||||
repo.open();
|
repo.open();
|
||||||
auto o1o = repo.getObject(1);
|
auto o1o = repo.getObject(1);
|
||||||
@@ -277,7 +277,7 @@ TEST(FileRepository, IDsDisabled) {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
Config conf;
|
Config conf;
|
||||||
conf.add("repo", "testrepo");
|
conf.add("repo", "IDS/testrepo");
|
||||||
FileRepository repo(conf);
|
FileRepository repo(conf);
|
||||||
repo.open();
|
repo.open();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user