summaryrefslogtreecommitdiff
path: root/verification-test
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-01-01 14:02:55 +0000
committerLars Wirzenius <liw@liw.fi>2012-01-01 14:02:55 +0000
commita2900b4bfb23e79bf2937e4fc1c79e6868ec0e36 (patch)
treeb52aa99b1a700702cd23894986eb0afe066624c6 /verification-test
parentb9875bd4e6abfdd63b71a0431a84214d694dfd56 (diff)
downloadobnam-a2900b4bfb23e79bf2937e4fc1c79e6868ec0e36.tar.gz
add config file support to verification-test
This will be useful for testing locking.
Diffstat (limited to 'verification-test')
-rwxr-xr-xverification-test26
1 files changed, 19 insertions, 7 deletions
diff --git a/verification-test b/verification-test
index 4128a823..30956263 100755
--- a/verification-test
+++ b/verification-test
@@ -20,6 +20,9 @@
# ./verification-test backup REPO DIR
# ./verification-test verify REPO DIR
#
+# You can optionally add the name of a configuration file to use as the
+# fourth argument.
+#
# You must run this script from the Obnam source directory.
# The repository must be a local directory.
# You can choose any DIR you like, but it should be something that changes
@@ -56,9 +59,11 @@ backup()
{
local repo="$1"
local dir="$2"
+ local conf="$3"
- ./obnam --no-default-configs -r "$repo" backup "$dir"
- local gen=$(./obnam --no-default-configs -r "$repo" genids | tail -n1)
+ ./obnam --no-default-configs --config="$conf" -r "$repo" backup "$dir"
+ local gen=$(./obnam --no-default-configs --config="$conf" -r "$repo" \
+ genids | tail -n1)
summain "$dir" -r --output="$repo/summain.$gen"
}
@@ -74,12 +79,14 @@ verify()
{
local repo="$1"
local dir=$(abspath "$2")
+ local conf="$3"
local tempdir="$(mktemp -d)"
- ./obnam --no-default-configs -r "$repo" genids |
+ ./obnam --no-default-configs --config="$conf" -r "$repo" genids |
while read gen
do
- ./obnam --no-default-configs -r "$repo" restore --to="$tempdir/$gen"
+ ./obnam --no-default-configs --config="$conf" -r "$repo" \
+ restore --to="$tempdir/$gen" --generation="$gen"
summain "$tempdir/$gen/$dir" -r --output="$tempdir/summain.$gen"
if ! diff -u "$repo/summain.$gen" "$tempdir/summain.$gen"
then
@@ -90,14 +97,19 @@ verify()
rmdir "$tempdir"
}
-[ "$#" = 3 ] || die "Bad usage, read source!"
+[ "$#" = 3 ] || [ "$#" = 4 ] || die "Bad usage, read source!"
+
+case "$#" in
+ 3) repo="$2"; root="$3"; conf="/dev/null" ;;
+ 4) repo="$2"; root="$3"; conf="$4" ;;
+esac
case "$1" in
backup)
- backup "$2" "$3"
+ backup "$repo" "$root" "$conf"
;;
verify)
- verify "$2" "$3"
+ verify "$repo" "$root" "$conf"
;;
*)
die "Unknown subcommand $1"