summaryrefslogtreecommitdiff
path: root/test-many-generations
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-04-13 10:53:32 +0100
committerLars Wirzenius <liw@liw.fi>2012-04-13 10:53:32 +0100
commit523f430db45eb4a5ca8ff5ad52e95948ce266668 (patch)
treeda67eea2a27078036b1beb2ecc12057124a43015 /test-many-generations
parenta653102d07f1d31fc92816a18e92b6669558c863 (diff)
downloadobnam-523f430db45eb4a5ca8ff5ad52e95948ce266668.tar.gz
Fix script to exit if verification-test fails
I had forgotten how counter-intuitive shell semantics can be sometimes. When a shell while loop reads from a pipe, the loop gets executed in a sub-shell, so calling exit in there doesn't actually call the parent script to exit. Stupid.
Diffstat (limited to 'test-many-generations')
-rwxr-xr-xtest-many-generations11
1 files changed, 7 insertions, 4 deletions
diff --git a/test-many-generations b/test-many-generations
index 74a86df1..d1acefc4 100755
--- a/test-many-generations
+++ b/test-many-generations
@@ -40,7 +40,7 @@ cat <<EOF > "$conf"
[config]
client-name = $client
quiet = yes
-log = $log
+log = $client.log
trace = obnamlib
repository = $repourl
root = $root
@@ -50,14 +50,17 @@ echo "Configuration:"
cat "$conf"
echo
+echo "Making backups"
seq "$N" |
while read gen
do
genbackupdata --quiet --create="$amount" "$root" --seed="$RANDOM"
find "$root" -exec touch --date="1970-01-01 00:00:$gen" '{}' ';'
- ./verification-test backup "$repopath" "$root" "$conf"
-done
+ ./verification-test backup "$repopath" "$root" "$conf" \
+ >> "$client-verif.output" 2>&1 || exit 1
+done || exit 1
+echo "Verifying results"
while true
do
./verification-test verify "$repopath" "$root" "$conf"
@@ -70,7 +73,7 @@ do
echo "$client failed verification" 1>&2
exit 1
fi
-done
+done || exit 1
rm -rf "$conf" "$root" "$log"