3 # Cumulus: Efficient Filesystem Backup to the Cloud
4 # Copyright (C) 2012 The Cumulus Developers
5 # See the AUTHORS file for a list of contributors.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 # Perform a simple Cumulus integration test: create a sample file tree, create
22 # a backup, modify the files, create a new backup, then try restoring and
23 # compare with the original state.
25 # Directory containing test scripts
26 TEST_DIR="$(readlink -f "$(dirname "$0")")"
28 # Directory containing Cumulus binaries
29 BIN_DIR="$(readlink -f "$TEST_DIR/..")"
31 # Directory where temporary files used for the tests can be stored.
32 TMP_DIR="$(readlink -f "$(mktemp -d cumulus-tests.XXXXXX)")"
36 echo "================================================================"
40 log_action "Starting tests: BIN_DIR=$BIN_DIR TMP_DIR=$TMP_DIR"
42 log_action "Initializing local database..."
43 LOCALDB="$TMP_DIR/database"
45 sqlite3 -init "$BIN_DIR/schema.sql" "$LOCALDB/localdb.sqlite" ".exit"
47 log_action "Creating test file system tree..."
50 cp "$BIN_DIR"/*.cc "$BIN_DIR"/*.h "$TREE"
51 cp -a "$BIN_DIR/python" "$TREE"
52 "$TEST_DIR"/digest_tree "$TREE" >"$TMP_DIR/digest.1"
54 log_action "Running initial backup..."
56 BACKUP_DIR="$TMP_DIR/backups"
58 "$BIN_DIR"/cumulus --dest="$BACKUP_DIR" --localdb="$LOCALDB" \
59 --scheme=test -v "$TREE"
61 log_action "Modifying files..."
63 cp -a "$BIN_DIR/third_party" "$TREE"
65 log_action "Running second backup..."
67 BACKUP_DIR="$TMP_DIR/backups"
69 "$BIN_DIR"/cumulus --dest="$BACKUP_DIR" --localdb="$LOCALDB" \
70 --scheme=test -v "$TREE"