1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#!/bin/sh
set -e
# Each test script should include testlib.sh
source testlib.sh
# When the test is ready, set this to false for nice outputs.
# if you want to see what happens, use those flags
# verbose="true"
# warnings="true"
# The conffile part of the test, see confs/* for details.
source confs/base.conf
source confs/tarball.conf
export BM_ARCHIVE_ROOT="repository"
export BM_ARCHIVE_METHOD="tarball-incremental"
export BM_TARBALL_DIRECTORIES="$PWD/test"
export BM_TARBALL_FILETYPE="dar"
export BM_TARBALLINC_MASTERDATETYPE="weekly"
# This test is for incremental backups, we don't want master backups!
export BM_TARBALLINC_MASTERDATEVALUE="999"
source $locallib/sanitize.sh
# The test actions
rm -rf test
mkdir -p test
mkdir test/dir1
touch test/file1
if [[ -e $BM_ARCHIVE_ROOT ]]; then
rm -f $BM_ARCHIVE_ROOT/*
fi
bm_init_env
bm_init_today
create_directories
make_archives
YESTERDAY=$(date +%Y%m%d --date '1 days ago')
name=$(get_dir_name "$PWD/test" long)
if [[ -e "$BM_ARCHIVE_ROOT/$BM_ARCHIVE_PREFIX$name.$TODAY.master.1.dar" ]]; then
mv "$BM_ARCHIVE_ROOT/$BM_ARCHIVE_PREFIX$name.$TODAY.master.1.dar" "$BM_ARCHIVE_ROOT/$BM_ARCHIVE_PREFIX$name.$YESTERDAY.master.1.dar"
mkdir test/dir2
touch test/file2
make_archives
# Now make sure file2 and dir2 are not saved in last darball
for file in file1 dir1
do
saved=$(dar -l $BM_ARCHIVE_ROOT/$BM_ARCHIVE_PREFIX$name.$TODAY.master | grep $file | awk '{print $1}')
if [[ "$saved" == "[saved]" ]]; then
warning "$file is saved in last archive, shouldn't."
rm -rf $PWD/test
rm -rf repository
exit 1
fi
done
rm -rf $PWD/test
rm -rf repository
exit 0
else
rm -rf $PWD/test
rm -rf repository
exit 1
fi
|