X-Git-Url: http://git.vrable.net/?p=cumulus.git;a=blobdiff_plain;f=tests%2Frun-test;h=843585a579014f122957ebde50197aab32d97ba7;hp=624a0bdb9d550c7fcff24dfa4d5b7e7be3085fe1;hb=HEAD;hpb=f546e4df51cde51dd984e4ad26e70dd7533f9791 diff --git a/tests/run-test b/tests/run-test index 624a0bd..843585a 100755 --- a/tests/run-test +++ b/tests/run-test @@ -31,6 +31,12 @@ BIN_DIR="$(readlink -f "$TEST_DIR/..")" # Directory where temporary files used for the tests can be stored. TMP_DIR="$(readlink -f "$(mktemp -d cumulus-tests.XXXXXX)")" +# Command to use for running memory leak tests. +VALGRIND="valgrind --tool=memcheck --leak-check=full --log-file=$TMP_DIR/valgrind.log" + +# Python interpreter to test with. +PYTHON="${PYTHON:-python2}" + log_action() { echo echo "================================================================" @@ -61,10 +67,22 @@ mkdir "$BACKUP_DIR" log_action "Modifying files..." rm "$TREE/"*.h cp -a "$BIN_DIR/third_party" "$TREE" +"$TEST_DIR"/digest_tree "$TREE" >"$TMP_DIR/digest.2" log_action "Running second backup..." sleep 5 -BACKUP_DIR="$TMP_DIR/backups" -mkdir "$BACKUP_DIR" -"$BIN_DIR"/cumulus --dest="$BACKUP_DIR" --localdb="$LOCALDB" \ +$VALGRIND "$BIN_DIR"/cumulus --dest="$BACKUP_DIR" --localdb="$LOCALDB" \ --scheme=test -v "$TREE" + +log_action "Restoring snapshots" +export LBS_GPG_PASSPHRASE="" +snapshots=$("$BIN_DIR"/cumulus-util --store="$BACKUP_DIR" list-snapshots) +echo "Available snapshots:" $snapshots +i=0 +for s in $snapshots; do + i=$((i + 1)) + dest="$TMP_DIR/restore-$i" + mkdir -p "$dest" + "$PYTHON" "$BIN_DIR"/cumulus-util --store="$BACKUP_DIR" \ + restore-snapshot $s "$dest" +done