]> arthur.barton.de Git - bup.git/commitdiff
Remove all of the remaining test-related "set -e" usage.
authorRob Browning <rlb@defaultvalue.org>
Sun, 27 Oct 2013 22:42:39 +0000 (17:42 -0500)
committerRob Browning <rlb@defaultvalue.org>
Fri, 1 Nov 2013 23:24:16 +0000 (18:24 -0500)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
13 files changed:
t/compare-trees
t/configure-sampledata
t/lib.sh
t/subtree-hash
t/test-cat-file.sh
t/test-command-without-init-fails.sh
t/test-index-check-device.sh
t/test-redundant-saves.sh
t/test-restore-single-file.sh
t/test-rm-between-index-and-save.sh
t/test-save-creates-no-unrefs.sh
t/test.sh
wvtest-bup.sh

index 2568f5fa698ccf824c1ce96ca3f86c34f9f65fee..5ef44a29edc396358afb71d73f50639c665a0e26 100755 (executable)
@@ -3,9 +3,6 @@
 # Test that src and dest trees are as identical as bup is capable of
 # making them.  For now, use rsync -niaHAX ...
 
-set -e
-set -o pipefail
-
 usage() {
 cat <<EOF
 Usage: compare-trees [-h] [-c] [-x] SOURCE DEST
@@ -31,7 +28,7 @@ do
     esac
 done
 
-shift $(($OPTIND - 1))
+shift $(($OPTIND - 1)) || exit $?
 
 if ! test $# -eq 2
 then
@@ -42,8 +39,8 @@ fi
 src="$1"
 dest="$2"
 
-tmpfile="$(mktemp /tmp/bup-test-XXXXXXX)"
-trap "rm -rf '${tmpfile}'" EXIT
+tmpfile="$(mktemp /tmp/bup-test-XXXXXXX)" || exit $?
+trap "rm -rf '$tmpfile'" EXIT || exit $?
 
 rsync_opts="-niaH$verify_content --delete"
 
@@ -67,11 +64,11 @@ else
     rsync_opts="$rsync_opts -X"
 fi
 
-rsync $rsync_opts "$src" "$dest" > "${tmpfile}"
+rsync $rsync_opts "$src" "$dest" > "$tmpfile" || exit $?
 
-if test $(wc -l < "${tmpfile}") != 0; then
+if test $(wc -l < "$tmpfile") != 0; then
     echo "Differences between $src and $dest"
-    cat "${tmpfile}"
+    cat "$tmpfile"
     exit 1
 fi
 
index d57d0dd7395379bc6dfc2881b978624261c2a38e..79bf8a44f49411ef032c4503c07390b41b8ce787 100755 (executable)
@@ -1,7 +1,5 @@
 #!/usr/bin/env bash
 
-set -e -o pipefail
-
 top=$(pwd)
 
 usage()
@@ -16,19 +14,19 @@ fi
 case "$1" in
     '--setup')
         (
-            cd t/sampledata
-            ln -sf a b
-            ln -sf b c
-            ln -sf /etc .
-        )
+            cd t/sampledata || exit $?
+            ln -sf a b || exit $?
+            ln -sf b c || exit $?
+            ln -sf /etc . || exit $?
+        ) || exit $?
         ;;
     '--clean')
         (
-            cd t/sampledata
+            cd t/sampledata || exit $?
             # test -e is false for dangling symlinks.
-            if test -h b -o -e b; then rm b; fi
-            if test -h c -o -e c; then rm c; fi
-            if test -h etc -o -e etc; then rm etc; fi
+            if test -h b -o -e b; then rm b || exit $?; fi
+            if test -h c -o -e c; then rm c || exit $?; fi
+            if test -h etc -o -e etc; then rm etc || exit $?; fi
         )
         ;;
     *)
index e7e2ce8d71458d31e2771e5c7282ed0695d23d73..a2e94de1fd651105568023ecc3604ada733380cd 100644 (file)
--- a/t/lib.sh
+++ b/t/lib.sh
@@ -20,11 +20,11 @@ force-delete()
 }
 
 realpath()
-(
-    set -e;
-    test "$#" -eq 1
-    script_home=$(cd "$(dirname $0)" && pwd)
+{
+    test "$#" -eq 1 || return $?
+    local script_home=$(cd "$(dirname $0)" && pwd)
     echo "$1" | \
         PYTHONPATH="${script_home}/../lib" python -c \
-        "import sys, bup.helpers; print bup.helpers.realpath(sys.stdin.readline())"
-)
+        "import sys, bup.helpers; print bup.helpers.realpath(sys.stdin.readline())" \
+        || return $?
+}
index 45e727c8bf2f51e5835737a5d186e2fdf5e9da21..e85b37fff5ffd2382fb5ec0e9f359a5fb6dc960c 100755 (executable)
@@ -1,7 +1,5 @@
 #!/usr/bin/env bash
 
-set -eo pipefail
-
 # Usage: subtree-hash ROOT_HASH [SUBDIR ...]
 
 subtree_hash()
@@ -13,7 +11,7 @@ subtree_hash()
         subdir="$2"
         subtree_info="$(git ls-tree "$root_hash" | grep -E "   $subdir\$")" || true
         if test "$(echo "$subtree_info" | wc -l)" -ne 1; then
-            echo "Found more than one matching line in subtree $root_hash" 1>&2
+            echo "Didn't find just one matching line in subtree $root_hash" 1>&2
             return 1
         fi
 
@@ -23,8 +21,8 @@ subtree_hash()
             return 1
         fi
 
-        shift 2
-        subtree_hash "$subtree_hash" "$@"
+        shift 2 || exit $?
+        subtree_hash "$subtree_hash" "$@" || exit $?
     fi
 }
 
index f5638f09a463e30690c8b5fd413519afb64906bb..58a9da39cd72e40e9f665c5b2b6418b215cb7251 100755 (executable)
@@ -1,21 +1,20 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh
 
-set -eo pipefail
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
 
-top="$(pwd)"
-tmpdir="$(wvmktempdir)"
 export BUP_DIR="$tmpdir/bup"
 export GIT_DIR="$tmpdir/bup"
 
 bup() { "$top/bup" "$@"; }
 
-bup init
-cd "$tmpdir"
+WVPASS bup init
+WVPASS cd "$tmpdir"
 
 WVSTART "cat-file"
-mkdir src
-date > src/foo
+WVPASS mkdir src
+WVPASS date > src/foo
 WVPASS bup index src
 WVPASS bup save -n src src
 WVPASS bup cat-file "src/latest/$(pwd)/src/foo" > cat-foo
@@ -24,16 +23,18 @@ WVPASS diff -u src/foo cat-foo
 WVSTART "cat-file --meta"
 WVPASS bup meta --create --no-paths src/foo > src-foo.meta
 WVPASS bup cat-file --meta "src/latest/$(pwd)/src/foo" > cat-foo.meta
-WVPASS diff -u \
-    <(bup meta -tvvf src-foo.meta | grep -vE '^atime: ') \
-    <(bup meta -tvvf cat-foo.meta | grep -vE '^atime: ')
+
+WVPASS bup meta -tvvf src-foo.meta | WVPASS grep -vE '^atime: ' > src-foo.list
+WVPASS bup meta -tvvf cat-foo.meta | WVPASS grep -vE '^atime: ' > cat-foo.list
+WVPASS diff -u src-foo.list cat-foo.list
 
 WVSTART "cat-file --bupm"
 WVPASS bup cat-file --bupm "src/latest/$(pwd)/src/" > bup-cat-bupm
-src_hash=$(bup ls -s "src/latest/$(pwd)" | cut -d' ' -f 1)
-bupm_hash=$(git ls-tree "$src_hash" | grep -F .bupm | cut -d' ' -f 3)
-bupm_hash=$(echo "$bupm_hash" | cut -d'        ' -f 1)
-git cat-file blob "$bupm_hash" > git-cat-bupm
+src_hash=$(WVPASS bup ls -s "src/latest/$(pwd)" | cut -d' ' -f 1) || exit $?
+bupm_hash=$(WVPASS git ls-tree "$src_hash" | grep -F .bupm | cut -d' ' -f 3) \
+    || exit $?
+bupm_hash=$(WVPASS echo "$bupm_hash" | cut -d' ' -f 1) || exit $?
+WVPASS git cat-file blob "$bupm_hash" > git-cat-bupm
 WVPASS cmp -b git-cat-bupm bup-cat-bupm
 
-rm -rf "$tmpdir"
+WVPASS rm -rf "$tmpdir"
index 896fc1f8b219241312ed4a7ca402fe309a9a95d4..3c5a0cd050c7545b9aed7fc638e9d12550941815 100755 (executable)
@@ -1,22 +1,19 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh
 
-set -e -o pipefail
-
 WVSTART 'all'
 
-top="$(pwd)"
-tmpdir="$(wvmktempdir)"
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
 export BUP_DIR="$tmpdir/bup"
 
 bup() { "$top/bup" "$@"; }
 
-mkdir "$tmpdir/foo"
+WVPASS mkdir "$tmpdir/foo"
 
-set +e
 bup index "$tmpdir/foo" &> /dev/null
 index_rc=$?
-set -e
 WVPASSEQ "$index_rc" "15"
 
-rm -rf "$tmpdir"
+WVPASS rm -rf "$tmpdir"
index 0ffc3b878ed997e4a5ac34a2a055d704f29c1e81..08b2aa7ebe0dbbadfc5acffd404062db63875e10 100755 (executable)
@@ -2,8 +2,6 @@
 . ./wvtest-bup.sh
 . ./t/lib.sh
 
-set -ex -o pipefail
-
 if [ $(t/root-status) != root ]; then
     echo 'Not root: skipping --check-device tests.'
     exit 0 # FIXME: add WVSKIP.
@@ -22,59 +20,60 @@ fi
 WVSTART '--check-device'
 
 top="$(pwd)"
-tmpdir="$(wvmktempdir)"
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
 export BUP_DIR="$tmpdir/bup"
 
 bup() { "$top/bup" "$@"; }
 
-srcmnt="$(wvmkmountpt)"
-tmpmnt1="$(wvmkmountpt)"
-tmpmnt2="$(wvmkmountpt)"
+srcmnt="$(WVPASS wvmkmountpt)" || exit $?
+tmpmnt1="$(WVPASS wvmkmountpt)" || exit $?
+tmpmnt2="$(WVPASS wvmkmountpt)" || exit $?
 
-cd "$tmpdir"
+WVPASS cd "$tmpdir"
 
-dd if=/dev/zero of=testfs.img bs=1M count=32
-mke2fs -F -j -m 0 testfs.img
-mount -o loop testfs.img "$tmpmnt1"
+WVPASS dd if=/dev/zero of=testfs.img bs=1M count=32
+WVPASS mke2fs -F -j -m 0 testfs.img
+WVPASS mount -o loop testfs.img "$tmpmnt1"
 # Hide, so that tests can't create risks.
-chown root:root "$tmpmnt1"
-chmod 0700 "$tmpmnt1"
+WVPASS chown root:root "$tmpmnt1"
+WVPASS chmod 0700 "$tmpmnt1"
 
 # Create trivial content.
-date > "$tmpmnt1/foo"
-umount "$tmpmnt1"
+WVPASS date > "$tmpmnt1/foo"
+WVPASS umount "$tmpmnt1"
 
 # Mount twice, so we'll have the same content with different devices.
-mount -oro,loop testfs.img "$tmpmnt1"
-mount -oro,loop testfs.img "$tmpmnt2"
+WVPASS mount -oro,loop testfs.img "$tmpmnt1"
+WVPASS mount -oro,loop testfs.img "$tmpmnt2"
 
 # Test default behavior: --check-device.
-mount -oro --bind "$tmpmnt1" "$srcmnt"
-bup init
-bup index --fake-valid "$srcmnt"
-umount "$srcmnt"
-mount -oro --bind "$tmpmnt2" "$srcmnt"
-bup index "$srcmnt"
+WVPASS mount -oro --bind "$tmpmnt1" "$srcmnt"
+WVPASS bup init
+WVPASS bup index --fake-valid "$srcmnt"
+WVPASS umount "$srcmnt"
+WVPASS mount -oro --bind "$tmpmnt2" "$srcmnt"
+WVPASS bup index "$srcmnt"
 WVPASSEQ "$(bup index --status "$srcmnt")" \
 "M $srcmnt/lost+found/
 M $srcmnt/foo
 M $srcmnt/"
-umount "$srcmnt"
+WVPASS umount "$srcmnt"
 
 WVSTART '--no-check-device'
-mount -oro --bind "$tmpmnt1" "$srcmnt"
-bup index --clear
-bup index --fake-valid "$srcmnt"
-umount "$srcmnt"
-mount -oro --bind "$tmpmnt2" "$srcmnt"
-bup index --no-check-device "$srcmnt"
-bup index --status "$srcmnt"
+WVPASS mount -oro --bind "$tmpmnt1" "$srcmnt"
+WVPASS bup index --clear
+WVPASS bup index --fake-valid "$srcmnt"
+WVPASS umount "$srcmnt"
+WVPASS mount -oro --bind "$tmpmnt2" "$srcmnt"
+WVPASS bup index --no-check-device "$srcmnt"
+WVPASS bup index --status "$srcmnt"
 WVPASSEQ "$(bup index --status "$srcmnt")" \
 "  $srcmnt/lost+found/
   $srcmnt/foo
   $srcmnt/"
 
-umount "$srcmnt"
-umount "$tmpmnt1"
-umount "$tmpmnt2"
-rm -r "$tmpmnt1" "$tmpmnt2" "$tmpdir"
+WVPASS umount "$srcmnt"
+WVPASS umount "$tmpmnt1"
+WVPASS umount "$tmpmnt2"
+WVPASS rm -r "$tmpmnt1" "$tmpmnt2" "$tmpdir"
index 5bf00b17cf1ec60db0d91e3d8902a834a00a6213..145994ad3fa70571514518819ea774019b5ca4a7 100755 (executable)
 
 . ./wvtest-bup.sh
 
-set -eo pipefail
-
 WVSTART 'all'
 
 top="$(pwd)"
-tmpdir="$(wvmktempdir)"
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
 export BUP_DIR="$tmpdir/bup"
 export GIT_DIR="$BUP_DIR"
 
 bup() { "$top/bup" "$@"; }
 
-mkdir -p "$tmpdir/src"
-mkdir -p "$tmpdir/src/d"
-mkdir -p "$tmpdir/src/d/e"
-touch "$tmpdir/src/"{f,b,a,d}
-touch "$tmpdir/src/d/z"
+WVPASS mkdir -p "$tmpdir/src"
+WVPASS mkdir -p "$tmpdir/src/d"
+WVPASS mkdir -p "$tmpdir/src/d/e"
+WVPASS touch "$tmpdir/src/"{f,b,a,d}
+WVPASS touch "$tmpdir/src/d/z"
 
 WVPASS bup init
 WVPASS bup index -u "$tmpdir/src"
@@ -37,21 +36,24 @@ indexed_top="${tmpdir##/}"
 indexed_top=(${indexed_top%%/})
 unset IFS
 
-tree1=$(bup save -t "$tmpdir/src") || WVFAIL
-indexed_tree1="$(t/subtree-hash "$tree1" "${indexed_top[@]}" src)"
+tree1=$(WVPASS bup save -t "$tmpdir/src") || exit $?
+indexed_tree1="$(WVPASS t/subtree-hash "$tree1" "${indexed_top[@]}" src)" \
+    || exit $?
 
-WVPASSEQ "$(cd "$tmpdir/src" && bup index -m)" ""
+result="$(WVPASS cd "$tmpdir/src"; WVPASS bup index -m)" || exit $?
+WVPASSEQ "$result" ""
 
-tree2=$(bup save -t "$tmpdir/src") || WVFAIL
-indexed_tree2="$(t/subtree-hash "$tree2" "${indexed_top[@]}" src)"
+tree2=$(WVPASS bup save -t "$tmpdir/src") || exit $?
+indexed_tree2="$(WVPASS t/subtree-hash "$tree2" "${indexed_top[@]}" src)" \
+    || exit $?
 
 WVPASSEQ "$indexed_tree1" "$indexed_tree2"
 
-WVPASSEQ "$(bup index -s / | grep ^D)" ""
-
-tree3=$(bup save -t /) || WVFAIL
-indexed_tree3="$(t/subtree-hash "$tree3" "${indexed_top[@]}")"
+result="$(WVPASS bup index -s / | WVFAIL grep ^D)" || exit $?
+WVPASSEQ "$result" ""
 
-WVPASSEQ "$indexed_tree3" "$indexed_tree3"
+tree3=$(WVPASS bup save -t /) || exit $?
+indexed_tree3="$(WVPASS t/subtree-hash "$tree3" "${indexed_top[@]}" src)" || exit $?
+WVPASSEQ "$indexed_tree1" "$indexed_tree3"
 
-rm -rf "$tmpdir"
+WVPASS rm -rf "$tmpdir"
index a0c429b653750912960227f718f3632da4b97afc..86df67f32d89d9d09991724a5f0b08e47380ee7d 100755 (executable)
@@ -1,25 +1,24 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh
 
-set -e -o pipefail
-
 WVSTART 'all'
 
-top="$(pwd)"
-tmpdir="$(wvmktempdir)"
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
 export BUP_DIR="$tmpdir/bup"
 
 bup() { "$top/bup" "$@"; }
 
-mkdir "$tmpdir/foo"
-mkdir "$tmpdir/foo/bar" # Make sure a dir sorts before baz (regression test).
-touch "$tmpdir/foo/baz"
-WVPASS bup init
-WVPASS bup index "$tmpdir/foo"
+WVPASS mkdir "$tmpdir/foo"
+WVPASS mkdir "$tmpdir/foo/bar" # Make sure a dir sorts before baz (regression test).
+WVPASS touch "$tmpdir/foo/baz"
+WVPASS WVPASS bup init
+WVPASS WVPASS bup index "$tmpdir/foo"
 WVPASS bup save -n foo "$tmpdir/foo"
 # Make sure the timestamps will differ if metadata isn't being restored.
 WVPASS bup tick
 WVPASS bup restore -C "$tmpdir/restore" "foo/latest/$tmpdir/foo/baz"
 WVPASS "$top/t/compare-trees" "$tmpdir/foo/baz" "$tmpdir/restore/baz"
 
-rm -rf "$tmpdir"
+WVPASS rm -rf "$tmpdir"
+
index 65a1a721941ac04c438a0d0a16b49190f1e3ed84..ce03befd71d1134de5677fa8fa894c46546c71fb 100755 (executable)
@@ -1,10 +1,8 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh
 
-set -e -o pipefail
-
-top="$(pwd)"
-tmpdir="$(wvmktempdir)"
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
 export BUP_DIR="$tmpdir/bup"
 D="$tmpdir/data"
 
@@ -13,17 +11,17 @@ bup() { "$top/bup" "$@"; }
 WVSTART "remove file"
 # Fixed in commit 8585613c1f45f3e20feec00b24fc7e3a948fa23e ("Store
 # metadata in the index....")
-mkdir "$D"
-bup init
-echo "content" > "$D"/foo
-echo "content" > "$D"/bar
-bup tick
-bup index -ux "$D"
-bup save -n save-fail-missing "$D"
-echo "content" > "$D"/baz
-bup tick
-bup index -ux "$D"
-rm "$D"/foo
+WVPASS mkdir "$D"
+WVPASS bup init
+WVPASS echo "content" > "$D"/foo
+WVPASS echo "content" > "$D"/bar
+WVPASS bup tick
+WVPASS bup index -ux "$D"
+WVPASS bup save -n save-fail-missing "$D"
+WVPASS echo "content" > "$D"/baz
+WVPASS bup tick
+WVPASS bup index -ux "$D"
+WVPASS rm "$D"/foo
 # When "bup tick" is removed above, this may fail (complete with warning),
 # since the ctime/mtime of "foo" might be pushed back:
 WVPASS bup save -n save-fail-missing "$D"
@@ -33,8 +31,8 @@ WVPASSEQ "$(bup ls -a save-fail-missing/latest/$TOP/$D/)" "bar
 baz
 foo"
 # index/save again
-bup tick
-bup index -ux "$D"
+WVPASS bup tick
+WVPASS bup index -ux "$D"
 WVPASS bup save -n save-fail-missing "$D"
 # now foo is gone:
 WVPASSEQ "$(bup ls -a save-fail-missing/latest/$TOP/$D/)" "bar
@@ -44,20 +42,20 @@ baz"
 # TODO: Test for racecondition between reading a file and reading its metadata?
 
 WVSTART "remove dir"
-rm -r "$D"
-mkdir "$D"
-rm -r "$BUP_DIR"
-bup init
-mkdir "$D"/foo
-mkdir "$D"/bar
-bup tick
-bup index -ux "$D"
-bup save -n save-fail-missing "$D"
-touch "$D"/bar
-mkdir "$D"/baz
-bup tick
-bup index -ux "$D"
-rmdir "$D"/foo
+WVPASS rm -r "$D"
+WVPASS mkdir "$D"
+WVPASS rm -r "$BUP_DIR"
+WVPASS bup init
+WVPASS mkdir "$D"/foo
+WVPASS mkdir "$D"/bar
+WVPASS bup tick
+WVPASS bup index -ux "$D"
+WVPASS bup save -n save-fail-missing "$D"
+WVPASS touch "$D"/bar
+WVPASS mkdir "$D"/baz
+WVPASS bup tick
+WVPASS bup index -ux "$D"
+WVPASS rmdir "$D"/foo
 # with directories, bup notices that foo is missing, so it fails
 # (complete with delayed error)
 WVFAIL bup save -n save-fail-missing "$D"
@@ -65,12 +63,13 @@ WVFAIL bup save -n save-fail-missing "$D"
 WVPASSEQ "$(bup ls -a save-fail-missing/latest/$TOP/$D/)" "bar/
 baz/"
 # Index again:
-bup tick
-bup index -ux "$D"
+WVPASS bup tick
+WVPASS bup index -ux "$D"
 # no non-zero-exitcode anymore:
 WVPASS bup save -n save-fail-missing "$D"
 # foo is (still...) missing, of course:
 WVPASSEQ "$(bup ls -a save-fail-missing/latest/$TOP/$D/)" "bar/
 baz/"
 
-rm -rf "$tmpdir"
+WVPASS rm -rf "$tmpdir"
+
index 229da4cf2421d55a7ff3b6acea783165a6e49c47..559f0ced4875c8692309ea3c8ecbf7598645f02d 100755 (executable)
@@ -1,24 +1,22 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh
 
-set -eo pipefail
-
 WVSTART 'all'
 
-top="$(pwd)"
-tmpdir="$(wvmktempdir)"
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
 export BUP_DIR="$tmpdir/bup"
 export GIT_DIR="$BUP_DIR"
 
 bup() { "$top/bup" "$@"; }
 
-mkdir -p "$tmpdir/src"
-touch "$tmpdir/src/foo"
-bup init
-bup index "$tmpdir/src"
-bup save -n src "$tmpdir/src"
+WVPASS mkdir -p "$tmpdir/src"
+WVPASS touch "$tmpdir/src/foo"
+WVPASS bup init
+WVPASS bup index "$tmpdir/src"
+WVPASS bup save -n src "$tmpdir/src"
 WVPASSEQ "$(git fsck --unreachable)" ""
-bup save -n src "$tmpdir/src"
+WVPASS bup save -n src "$tmpdir/src"
 WVPASSEQ "$(git fsck --unreachable)" ""
 
-rm -rf "$tmpdir"
+WVPASS rm -rf "$tmpdir"
index 83528458dac9fd417d787bc5d279979abbefb4f5..3f96ab005a80d9d835d8c344029d0d848f057492 100755 (executable)
--- a/t/test.sh
+++ b/t/test.sh
@@ -2,9 +2,7 @@
 . wvtest.sh
 . t/lib.sh
 
-#set -e
-
-TOP="$(/bin/pwd)"
+TOP="$(WVPASS /bin/pwd)" || exit $?
 export BUP_DIR="$TOP/buptest.tmp"
 
 bup()
@@ -14,14 +12,13 @@ bup()
 
 WVSTART "init"
 
-#set -x
-test -d "$BUP_DIR" && rm -r "$BUP_DIR"
+WVPASS rm -rf "$BUP_DIR"
 WVPASS bup init
 
 WVSTART "index"
 D=bupdata.tmp
-force-delete $D
-mkdir $D
+WVPASS force-delete $D
+WVPASS mkdir $D
 WVFAIL bup index --exclude-from $D/cannot-exist $D
 WVPASSEQ "$(bup index --check -p)" ""
 WVPASSEQ "$(bup index --check -p $D)" ""
@@ -29,9 +26,9 @@ WVFAIL [ -e $D.fake ]
 WVFAIL bup index --check -u $D.fake
 WVPASS bup index --check -u $D
 WVPASSEQ "$(bup index --check -p $D)" "$D/"
-touch $D/a
+WVPASS touch $D/a
 WVPASS bup random 128k >$D/b
-mkdir $D/d $D/d/e
+WVPASS mkdir $D/d $D/d/e
 WVPASS bup random 512 >$D/f
 WVPASS ln -s non-existent-file $D/g
 WVPASSEQ "$(bup index -s $D/)" "A $D/"
@@ -41,8 +38,8 @@ WVPASSEQ "$(bup index --check -us $D/b $D/d)" \
 "A $D/d/e/
 A $D/d/
 A $D/b"
-touch $D/d/z
-bup tick
+WVPASS touch $D/d/z
+WVPASS bup tick
 WVPASSEQ "$(bup index --check -usx $D)" \
 "A $D/g
 A $D/f
@@ -60,7 +57,7 @@ WVPASSEQ "$(bup index --check -us $D/d --fake-valid)" \
 "  $D/d/z
   $D/d/e/
   $D/d/"
-touch $D/d/z
+WVPASS touch $D/d/z
 WVPASS bup index -u $D/d/z  # becomes modified
 WVPASSEQ "$(bup index -s $D/a $D $D/b)" \
 "A $D/g
@@ -93,16 +90,16 @@ WVPASSEQ "$(cd $D && bup index -s .)" "$(cd $D && bup index -s .)"
 
 WVFAIL bup save -t $D/doesnt-exist-filename
 
-mv $BUP_DIR/bupindex $BUP_DIR/bi.old
+WVPASS mv $BUP_DIR/bupindex $BUP_DIR/bi.old
 WVFAIL bup save -t $D/d/e/fifotest
-mkfifo $D/d/e/fifotest
+WVPASS mkfifo $D/d/e/fifotest
 WVPASS bup index -u $D/d/e/fifotest
 WVPASS bup save -t $D/d/e/fifotest
 WVPASS bup save -t $D/d/e
-rm -f $D/d/e/fifotest
+WVPASS rm -f $D/d/e/fifotest
 WVPASS bup index -u $D/d/e
 WVFAIL bup save -t $D/d/e/fifotest
-mv $BUP_DIR/bi.old $BUP_DIR/bupindex
+WVPASS mv $BUP_DIR/bi.old $BUP_DIR/bupindex
 
 WVPASS bup index -u $D/d/e
 WVPASS bup save -t $D/d/e
@@ -128,11 +125,11 @@ WVFAIL bup save -r :$BUP_DIR/fake/path -n r-test $D
 WVFAIL bup save -r :$BUP_DIR -n r-test $D/fake/path
 
 WVSTART "split"
-echo a >a.tmp
-echo b >b.tmp
+WVPASS echo a >a.tmp
+WVPASS echo b >b.tmp
 WVPASS bup split -b a.tmp >taga.tmp
 WVPASS bup split -b b.tmp >tagb.tmp
-cat a.tmp b.tmp | WVPASS bup split -b >tagab.tmp
+WVPASS cat a.tmp b.tmp | WVPASS bup split -b >tagab.tmp
 WVPASSEQ $(cat taga.tmp | wc -l) 1
 WVPASSEQ $(cat tagb.tmp | wc -l) 1
 WVPASSEQ $(cat tagab.tmp | wc -l) 1
@@ -157,7 +154,7 @@ WVPASS bup midx -o $BUP_DIR/objects/pack/test1.midx \
 WVPASS bup midx --check -a
 all=$(echo $BUP_DIR/objects/pack/*.idx $BUP_DIR/objects/pack/*.midx)
 WVPASS bup midx -o $BUP_DIR/objects/pack/zzz.midx $all
-bup tick
+WVPASS bup tick
 WVPASS bup midx -o $BUP_DIR/objects/pack/yyy.midx $all
 WVPASS bup midx -a
 WVPASSEQ "$(echo $BUP_DIR/objects/pack/*.midx)" \
@@ -179,12 +176,12 @@ WVFAIL diff -u tags1.tmp tags2.tmp
 
 # fanout must be different from non-fanout
 WVFAIL diff tags2t.tmp tags2tf.tmp
-wc -c t/testfile1 t/testfile2
-wc -l tags1.tmp tags2.tmp
+WVPASS wc -c t/testfile1 t/testfile2
+WVPASS wc -l tags1.tmp tags2.tmp
 
 WVSTART "bloom"
 WVPASS bup bloom -c $(ls -1 $BUP_DIR/objects/pack/*.idx|head -n1)
-rm $BUP_DIR/objects/pack/bup.bloom
+WVPASS rm $BUP_DIR/objects/pack/bup.bloom
 WVPASS bup bloom -k 4
 WVPASS bup bloom -c $(ls -1 $BUP_DIR/objects/pack/*.idx|head -n1)
 WVPASS bup bloom -d buptest.tmp/objects/pack --ruin --force
@@ -209,38 +206,38 @@ WVPASS diff -u t/testfile2 out2c.tmp
 
 WVSTART "save/git-fsck"
 (
-    set -e
-    cd "$BUP_DIR" || exit 1
+    WVPASS cd "$BUP_DIR"
     #git repack -Ad
     #git prune
-    (cd "$TOP/t/sampledata" && WVPASS bup save -vvn master /) || WVFAIL
-    n=$(git fsck --full --strict 2>&1 | 
-      egrep -v 'dangling (commit|tree|blob)' |
-      tee -a /dev/stderr | 
-      wc -l)
+    (WVPASS cd "$TOP/t/sampledata" && WVPASS bup save -vvn master /) || exit $?
+    result="$(git fsck --full --strict 2>&1)" || exit $?
+    n=$(echo "$result" |
+        egrep -v 'dangling (commit|tree|blob)' |
+        WVPASS tee -a /dev/stderr |
+        WVPASS wc -l) || exit $?
     WVPASS [ "$n" -eq 0 ]
-) || exit 1
+) || exit $?
 
 WVSTART "restore"
-force-delete buprestore.tmp
+WVPASS force-delete buprestore.tmp
 WVFAIL bup restore boink
-touch $TOP/$D/$D
-bup index -u $TOP/$D
-bup save -n master /
+WVPASS touch $TOP/$D/$D
+WVPASS bup index -u $TOP/$D
+WVPASS bup save -n master /
 WVPASS bup restore -C buprestore.tmp "/master/latest/$TOP/$D"
 WVPASSEQ "$(ls buprestore.tmp)" "bupdata.tmp"
-force-delete buprestore.tmp
+WVPASS force-delete buprestore.tmp
 WVPASS bup restore -C buprestore.tmp "/master/latest/$TOP/$D/"
-touch $D/non-existent-file buprestore.tmp/non-existent-file # else diff fails
+WVPASS touch $D/non-existent-file buprestore.tmp/non-existent-file # else diff fails
 WVPASS diff -ur $D/ buprestore.tmp/
 
 (
     tmp=testrestore.tmp
-    force-delete $tmp
-    mkdir $tmp
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
     export BUP_DIR="$(pwd)/$tmp/bup"
-    WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS WVPASS bup init
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
@@ -251,34 +248,34 @@ WVPASS diff -ur $D/ buprestore.tmp/
     WVPASS t/compare-trees $tmp/src/ $tmp/restore/latest/
 
     WVSTART "restore /foo/latest/"
-    force-delete "$tmp/restore"
+    WVPASS force-delete "$tmp/restore"
     WVPASS bup restore -C $tmp/restore /foo/latest/
     for x in $tmp/src/*; do
         WVPASS t/compare-trees $x/ $tmp/restore/$(basename $x);
     done
 
     WVSTART "restore /foo/latest/."
-    force-delete "$tmp/restore"
+    WVPASS force-delete "$tmp/restore"
     WVPASS bup restore -C $tmp/restore /foo/latest/.
     WVPASS t/compare-trees $tmp/src/ $tmp/restore/
 
     WVSTART "restore /foo/latest/x"
-    force-delete "$tmp/restore"
+    WVPASS force-delete "$tmp/restore"
     WVPASS bup restore -C $tmp/restore /foo/latest/x
     WVPASS t/compare-trees $tmp/src/x/ $tmp/restore/x/
 
     WVSTART "restore /foo/latest/x/"
-    force-delete "$tmp/restore"
+    WVPASS force-delete "$tmp/restore"
     WVPASS bup restore -C $tmp/restore /foo/latest/x/
     for x in $tmp/src/x/*; do
         WVPASS t/compare-trees $x/ $tmp/restore/$(basename $x);
     done
 
     WVSTART "restore /foo/latest/x/."
-    force-delete "$tmp/restore"
+    WVPASS force-delete "$tmp/restore"
     WVPASS bup restore -C $tmp/restore /foo/latest/x/.
     WVPASS t/compare-trees $tmp/src/x/ $tmp/restore/
-) || WVFAIL
+) || exit $?
 
 
 WVSTART "ftp"
@@ -313,7 +310,7 @@ WVPASS bup fsck -r
 WVPASS bup damage $BUP_DIR/objects/pack/*.pack -n10 -s1 -S0
 WVFAIL bup fsck --quick
 WVFAIL bup fsck --quick --disable-par2
-chmod u+w $BUP_DIR/objects/pack/*.idx
+WVPASS chmod u+w $BUP_DIR/objects/pack/*.idx
 WVPASS bup damage $BUP_DIR/objects/pack/*.idx -n10 -s1 -S0
 WVFAIL bup fsck --quick -j4
 WVPASS bup damage $BUP_DIR/objects/pack/*.pack -n10 -s1024 --percent 0.4 -S0
@@ -331,16 +328,16 @@ fi
 
 WVSTART "exclude-bupdir"
 D=exclude-bupdir.tmp
-force-delete $D
-mkdir $D
+WVPASS force-delete $D
+WVPASS mkdir $D
 export BUP_DIR="$D/.bup"
 WVPASS bup init
-touch $D/a
+WVPASS touch $D/a
 WVPASS bup random 128k >$D/b
-mkdir $D/d $D/d/e
+WVPASS mkdir $D/d $D/d/e
 WVPASS bup random 512 >$D/f
 WVPASS bup index -ux $D
-bup save -n exclude-bupdir $D
+WVPASS bup save -n exclude-bupdir $D
 WVPASSEQ "$(bup ls -a exclude-bupdir/latest/$TOP/$D/)" "a
 b
 d/
@@ -348,169 +345,166 @@ f"
 
 WVSTART "exclude"
 (
-    set -e -o pipefail
     D=exclude.tmp
-    force-delete $D
-    mkdir $D
+    WVPASS force-delete $D
+    WVPASS mkdir $D
     export BUP_DIR="$D/.bup"
     WVPASS bup init
-    touch $D/a
+    WVPASS touch $D/a
     WVPASS bup random 128k >$D/b
-    mkdir $D/d $D/d/e
+    WVPASS mkdir $D/d $D/d/e
     WVPASS bup random 512 >$D/f
     WVPASS bup random 512 >$D/j
     WVPASS bup index -ux --exclude $D/d --exclude $D/j $D
-    bup save -n exclude $D
+    WVPASS bup save -n exclude $D
     WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a
 b
 f"
-    mkdir $D/g $D/h
+    WVPASS mkdir $D/g $D/h
     WVPASS bup index -ux --exclude $D/d --exclude $TOP/$D/g --exclude $D/h \
         --exclude $TOP/$D/j $D
-    bup save -n exclude $D
+    WVPASS bup save -n exclude $D
     WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a
 b
 f"
-) || WVFAIL
+) || exit $?
 
 WVSTART "exclude-from"
 (
-    set -e -o pipefail
     D=exclude-fromdir.tmp
     EXCLUDE_FILE=exclude-from.tmp
-    echo "$D/d 
+    WVPASS echo "$D/d 
  $TOP/$D/g
 $D/h
 $D/i" > $EXCLUDE_FILE
-    force-delete $D
-    mkdir $D
+    WVPASS force-delete $D
+    WVPASS mkdir $D
     export BUP_DIR="$D/.bup"
     WVPASS bup init
-    touch $D/a
+    WVPASS touch $D/a
     WVPASS bup random 128k >$D/b
-    mkdir $D/d $D/d/e
+    WVPASS mkdir $D/d $D/d/e
     WVPASS bup random 512 >$D/f
-    mkdir $D/g $D/h
+    WVPASS mkdir $D/g $D/h
     WVPASS bup random 128k > $D/i
     WVPASS bup index -ux --exclude-from $EXCLUDE_FILE $D
-    bup save -n exclude-from $D
+    WVPASS bup save -n exclude-from $D
     WVPASSEQ "$(bup ls exclude-from/latest/$TOP/$D/)" "a
 b
 f"
-    rm $EXCLUDE_FILE
-) || WVFAIL
+    WVPASS rm $EXCLUDE_FILE
+) || exit $?
 
 WVSTART "save (no index)"
 (
-    set -e
     tmp=save-no-index.tmp
-    force-delete $tmp
-    mkdir $tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
     WVPASS bup init
     WVFAIL bup save -n nothing /
-    rm -r "$tmp"
-) || WVFAIL
+    WVPASS rm -r "$tmp"
+) || exit $?
 
 WVSTART "save --strip"
 (
     tmp=graft-points.tmp
-    force-delete $tmp
-    mkdir $tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
     WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
     WVPASS bup save --strip -n foo $tmp/src/x/y
     WVPASS bup restore -C $tmp/restore /foo/latest
     WVPASS t/compare-trees $tmp/src/x/y/ "$tmp/restore/latest/"
-) || WVFAIL
+) || exit $?
 
 WVSTART "save --strip-path (relative)"
 (
     tmp=graft-points.tmp
-    force-delete $tmp
-    mkdir $tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
     WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
     WVPASS bup save --strip-path $tmp/src -n foo $tmp/src/x
     WVPASS bup restore -C $tmp/restore /foo/latest
     WVPASS t/compare-trees $tmp/src/ "$tmp/restore/latest/"
-) || WVFAIL
+) || exit $?
 
 WVSTART "save --strip-path (absolute)"
 (
     tmp=graft-points.tmp
-    force-delete $tmp
-    mkdir $tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
     WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
     WVPASS bup save --strip-path "$TOP" -n foo $tmp/src
     WVPASS bup restore -C $tmp/restore /foo/latest
     WVPASS t/compare-trees $tmp/src/ "$tmp/restore/latest/$tmp/src/"
-) || WVFAIL
+) || exit $?
 
 WVSTART "save --strip-path (no match)"
 (
     tmp=graft-points.tmp
-    force-delete $tmp
-    mkdir $tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
     WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
     WVPASS bup save --strip-path $tmp/foo -n foo $tmp/src/x
     WVPASS bup restore -C $tmp/restore /foo/latest
     WVPASS t/compare-trees $tmp/src/ "$tmp/restore/latest/$TOP/$tmp/src/"
-) || WVFAIL
+) || exit $?
 
 WVSTART "save --graft (empty graft points disallowed)"
 (
     tmp=graft-points.tmp
-    force-delete $tmp
-    mkdir $tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
     WVPASS bup init
     WVFAIL bup save --graft =/grafted -n graft-point-absolute $tmp
     WVFAIL bup save --graft $TOP/$tmp= -n graft-point-absolute $tmp
-) || WVFAIL
+) || exit $?
 
 WVSTART "save --graft /x/y=/a/b (relative paths)"
 (
     tmp=graft-points.tmp
-    force-delete $tmp
-    mkdir $tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
     WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
     WVPASS bup save --graft $tmp/src=x -n foo $tmp/src
     WVPASS bup restore -C $tmp/restore /foo/latest
     WVPASS t/compare-trees $tmp/src/ "$tmp/restore/latest/$TOP/x/"
-) || WVFAIL
+) || exit $?
 
 WVSTART "save --graft /x/y=/a/b (matching structure)"
 (
     tmp=graft-points.tmp
-    force-delete $tmp
-    mkdir $tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
     WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
@@ -519,32 +513,32 @@ WVSTART "save --graft /x/y=/a/b (matching structure)"
     WVPASS bup restore -C $tmp/restore /foo/latest
     WVPASS t/compare-trees $tmp/src/x/y/ \
         "$tmp/restore/latest/$TOP/$tmp/src/a/b/"
-) || WVFAIL
+) || exit $?
 
 WVSTART "save --graft /x/y=/a (shorter target)"
 (
     tmp=graft-points.tmp
-    force-delete $tmp
-    mkdir $tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
     WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
     WVPASS bup save -v --graft "$TOP/$tmp/src/x/y=/a" -n foo $tmp/src/x/y
     WVPASS bup restore -C $tmp/restore /foo/latest
     WVPASS t/compare-trees $tmp/src/x/y/ "$tmp/restore/latest/a/"
-) || WVFAIL
+) || exit $?
 
 WVSTART "save --graft /x=/a/b (longer target)"
 (
     tmp=graft-points.tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
-    force-delete $tmp
-    mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
     WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
@@ -552,23 +546,23 @@ WVSTART "save --graft /x=/a/b (longer target)"
         -n foo $tmp/src
     WVPASS bup restore -C $tmp/restore /foo/latest
     WVPASS t/compare-trees $tmp/src/ "$tmp/restore/latest/$TOP/$tmp/src/a/b/c/"
-) || WVFAIL
+) || exit $?
 
 WVSTART "save --graft /x=/ (root target)"
 (
     tmp=graft-points.tmp
-    export BUP_DIR="$(pwd)/$tmp/bup"
-    force-delete $tmp
-    mkdir $tmp
+    export BUP_DIR="$(WVPASS pwd)/$tmp/bup" || exit $?
+    WVPASS force-delete $tmp
+    WVPASS mkdir $tmp
     WVPASS bup init
-    mkdir -p $tmp/src/x/y/z
+    WVPASS mkdir -p $tmp/src/x/y/z
     WVPASS bup random 8k > $tmp/src/x/y/random-1
     WVPASS bup random 8k > $tmp/src/x/y/z/random-2
     WVPASS bup index -u $tmp/src
     WVPASS bup save -v --graft "$TOP/$tmp/src/x=/" -n foo $tmp/src/x
     WVPASS bup restore -C $tmp/restore /foo/latest
     WVPASS t/compare-trees $tmp/src/x/ "$tmp/restore/latest/"
-) || WVFAIL
+) || exit $?
 
 #WVSTART "save --graft /=/x/ (root source)"
 # FIXME: Not tested for now -- will require cleverness, or caution as root.
@@ -576,21 +570,21 @@ WVSTART "save --graft /x=/ (root target)"
 WVSTART "indexfile"
 D=indexfile.tmp
 INDEXFILE=tmpindexfile.tmp
-rm -f $INDEXFILE
-force-delete $D
-mkdir $D
+WVPASS rm -f $INDEXFILE
+WVPASS force-delete $D
+WVPASS mkdir $D
 export BUP_DIR="$D/.bup"
 WVPASS bup init
-touch $D/a
-touch $D/b
-mkdir $D/c
+WVPASS touch $D/a
+WVPASS touch $D/b
+WVPASS mkdir $D/c
 WVPASS bup index -ux $D
-bup save --strip -n bupdir $D
+WVPASS bup save --strip -n bupdir $D
 WVPASSEQ "$(bup ls bupdir/latest/)" "a
 b
 c/"
 WVPASS bup index -f $INDEXFILE --exclude=$D/c -ux $D
-bup save --strip -n indexfile -f $INDEXFILE $D
+WVPASS bup save --strip -n indexfile -f $INDEXFILE $D
 WVPASSEQ "$(bup ls indexfile/latest/)" "a
 b"
 
@@ -598,13 +592,13 @@ b"
 WVSTART "import-rsnapshot"
 D=rsnapshot.tmp
 export BUP_DIR="$TOP/$D/.bup"
-force-delete $D
-mkdir $D
+WVPASS force-delete $D
+WVPASS mkdir $D
 WVPASS bup init
-mkdir -p $D/hourly.0/buptest/a
-touch $D/hourly.0/buptest/a/b
-mkdir -p $D/hourly.0/buptest/c/d
-touch $D/hourly.0/buptest/c/d/e
+WVPASS mkdir -p $D/hourly.0/buptest/a
+WVPASS touch $D/hourly.0/buptest/a/b
+WVPASS mkdir -p $D/hourly.0/buptest/c/d
+WVPASS touch $D/hourly.0/buptest/c/d/e
 WVPASS true
 WVPASS bup import-rsnapshot $D/
 WVPASSEQ "$(bup ls buptest/latest/)" "a/
@@ -615,13 +609,13 @@ if [ "$(which rdiff-backup)" != "" ]; then
     WVSTART "import-rdiff-backup"
     D=rdiff-backup.tmp
     export BUP_DIR="$TOP/$D/.bup"
-    force-delete $D
-    mkdir $D
+    WVPASS force-delete $D
+    WVPASS mkdir $D
     WVPASS bup init
-    mkdir $D/rdiff-backup
-    rdiff-backup $TOP/cmd $D/rdiff-backup
-    bup tick
-    rdiff-backup $TOP/Documentation $D/rdiff-backup
+    WVPASS mkdir $D/rdiff-backup
+    WVPASS rdiff-backup $TOP/cmd $D/rdiff-backup
+    WVPASS bup tick
+    WVPASS rdiff-backup $TOP/Documentation $D/rdiff-backup
     WVPASS bup import-rdiff-backup $D/rdiff-backup import-rdiff-backup
     WVPASSEQ "$(bup ls import-rdiff-backup/ | wc -l)" "3"
     WVPASSEQ "$(bup ls import-rdiff-backup/latest/ | sort)" "$(ls $TOP/Documentation | sort)"
@@ -631,124 +625,128 @@ fi
 WVSTART "compression"
 D=compression0.tmp
 export BUP_DIR="$TOP/$D/.bup"
-force-delete $D
-mkdir $D
+WVPASS force-delete $D
+WVPASS mkdir $D
 WVPASS bup init
 WVPASS bup index $TOP/Documentation
 WVPASS bup save -n compression -0 --strip $TOP/Documentation
 # 'ls' on NetBSD sets -A by default when running as root, so we have to undo
 # it by grepping out any dotfiles.  (Normal OSes don't auto-set -A, but this
 # is harmless there.)
-WVPASSEQ "$(bup ls compression/latest/ | sort)" \
-        "$(ls $TOP/Documentation | grep -v '^\.' | sort)"
-COMPRESSION_0_SIZE=$(du -k -s $D | cut -f1)
+expected="$(WVPASS ls $TOP/Documentation | grep -v '^\.' | WVPASS sort)" \
+    || exit $?
+actual="$(WVPASS bup ls compression/latest/ | WVPASS sort)" || exit $?
+WVPASSEQ "$actual" "$expected"
+COMPRESSION_0_SIZE=$(WVPASS du -k -s $D | WVPASS cut -f1) || exit $?
 
 D=compression9.tmp
 export BUP_DIR="$TOP/$D/.bup"
-force-delete $D
-mkdir $D
+WVPASS force-delete $D
+WVPASS mkdir $D
 WVPASS bup init
 WVPASS bup index $TOP/Documentation
 WVPASS bup save -n compression -9 --strip $TOP/Documentation
 WVPASSEQ "$(bup ls compression/latest/ | sort)" \
          "$(ls $TOP/Documentation | grep -v '^\.' | sort)"
-COMPRESSION_9_SIZE=$(du -k -s $D | cut -f1)
+COMPRESSION_9_SIZE=$(WVPASS du -k -s $D | WVPASS cut -f1) || exit $?
 
 WVPASS [ "$COMPRESSION_9_SIZE" -lt "$COMPRESSION_0_SIZE" ]
 
-
 WVSTART "save disjoint top-level directories"
 (
-    set -e
     # Resolve any symlinks involving the top top-level dirs.
-    real_pwd="$(realpath .)"
-    real_tmp="$(realpath /tmp/.)"
-    pwd_top="$(echo $real_pwd | awk -F "/" '{print $2}')"
-    tmp_top="$(echo $real_tmp | awk -F "/" '{print $2}')"
+    real_pwd="$(WVPASS realpath .)" || exit $?
+    real_tmp="$(WVPASS realpath /tmp/.)" || exit $?
+    pwd_top="$(echo $real_pwd | WVPASS awk -F "/" '{print $2}')" || exit $?
+    tmp_top="$(echo $real_tmp | WVPASS awk -F "/" '{print $2}')" || exit $?
+
     if [ "$pwd_top" = "$tmp_top" ]; then
-        echo "(running from within /$tmp_top; skipping test)"
+        echo "(running from within /$tmp_top; skipping test)" 1>&2
         exit 0
     fi
     D=bupdata.tmp
-    force-delete $D
-    mkdir -p $D/x
-    date > $D/x/1
-    tmpdir="$(mktemp -d $real_tmp/bup-test-XXXXXXX)"
-    cleanup() { set -x; rm -r "${tmpdir}"; set +x; }
-    trap cleanup EXIT
-    date > "$tmpdir/2"
+    WVPASS force-delete $D
+    WVPASS mkdir -p $D/x
+    WVPASS date > $D/x/1
+    tmpdir="$(WVPASS mktemp -d $real_tmp/bup-test-XXXXXXX)" || exit $?
+    cleanup() { WVPASS rm -r "${tmpdir}"; }
+    WVPASS trap cleanup EXIT
+    WVPASS date > "$tmpdir/2"
 
     export BUP_DIR="$TOP/buptest.tmp"
-    test -d "$BUP_DIR" && rm -r "$BUP_DIR"
+    WVPASS test -d "$BUP_DIR" && WVPASS rm -r "$BUP_DIR"
 
     WVPASS bup init
     WVPASS bup index -vu $(pwd)/$D/x "$tmpdir"
     WVPASS bup save -t -n src $(pwd)/$D/x "$tmpdir"
 
     # For now, assume that "ls -a" and "sort" use the same order.
-    WVPASSEQ "$(bup ls -a src/latest)" \
-        "$(echo -e "$pwd_top/\n$tmp_top/" | sort)"
-) || WVFAIL
+    actual="$(WVPASS bup ls -a src/latest)" || exit $?
+    expected="$(echo -e "$pwd_top/\n$tmp_top/" | WVPASS sort)" || exit $?
+    WVPASSEQ "$actual" "$expected"
+) || exit $?
 
 WVSTART "clear-index"
 D=clear-index.tmp
 export BUP_DIR="$TOP/$D/.bup"
-force-delete $TOP/$D
-mkdir $TOP/$D
+WVPASS force-delete $TOP/$D
+WVPASS mkdir $TOP/$D
 WVPASS bup init
-touch $TOP/$D/foo
-touch $TOP/$D/bar
-bup index -u $D
+WVPASS touch $TOP/$D/foo
+WVPASS touch $TOP/$D/bar
+WVPASS bup index -u $D
 WVPASSEQ "$(bup index -p)" "$D/foo
 $D/bar
 $D/
 ./"
-rm $TOP/$D/foo
+WVPASS rm $TOP/$D/foo
 WVPASS bup index --clear
-bup index -u $TOP/$D
-WVPASSEQ "$(bup index -p)" "$D/bar
+WVPASS bup index -u $TOP/$D
+expected="$(WVPASS bup index -p)" || exit $?
+WVPASSEQ "$expected" "$D/bar
 $D/
 ./"
 
 # bup index --exclude-rx ...
 (
-    set -e
     export BUP_DIR="$TOP/buptest.tmp"
     D=bupdata.tmp
 
     WVSTART "index --exclude-rx '^/foo' (root anchor)"
-    rm -rf "$D" "$BUP_DIR" buprestore.tmp
+    WVPASS rm -rf "$D" "$BUP_DIR" buprestore.tmp
     WVPASS bup init
-    mkdir $D
-    touch $D/a
-    touch $D/b
-    mkdir $D/sub1
-    mkdir $D/sub2
-    touch $D/sub1/a
-    touch $D/sub2/b
+    WVPASS mkdir $D
+    WVPASS touch $D/a
+    WVPASS touch $D/b
+    WVPASS mkdir $D/sub1
+    WVPASS mkdir $D/sub2
+    WVPASS touch $D/sub1/a
+    WVPASS touch $D/sub2/b
     WVPASS bup index -u $D --exclude-rx "^$(pwd)/$D/sub1/"
-    bup save --strip -n bupdir $D
-    bup restore -C buprestore.tmp /bupdir/latest/
-    WVPASSEQ "$(cd buprestore.tmp && find . | sort)" ".
+    WVPASS bup save --strip -n bupdir $D
+    WVPASS bup restore -C buprestore.tmp /bupdir/latest/
+    actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
+    WVPASSEQ "$actual" ".
 ./a
 ./b
 ./sub2
 ./sub2/b"
 
     WVSTART "index --exclude-rx '/foo$' (non-dir, tail anchor)"
-    rm -rf "$D" "$BUP_DIR" buprestore.tmp
+    WVPASS rm -rf "$D" "$BUP_DIR" buprestore.tmp
     WVPASS bup init
-    mkdir $D
-    touch $D/a
-    touch $D/b
-    touch $D/foo
-    mkdir $D/sub
-    mkdir $D/sub/foo
-    touch $D/sub/foo/a
+    WVPASS mkdir $D
+    WVPASS touch $D/a
+    WVPASS touch $D/b
+    WVPASS touch $D/foo
+    WVPASS mkdir $D/sub
+    WVPASS mkdir $D/sub/foo
+    WVPASS touch $D/sub/foo/a
     WVPASS bup index -u $D --exclude-rx '/foo$'
-    bup save --strip -n bupdir $D
-    bup restore -C buprestore.tmp /bupdir/latest/
-    WVPASSEQ "$(cd buprestore.tmp && find . | sort)" ".
+    WVPASS bup save --strip -n bupdir $D
+    WVPASS bup restore -C buprestore.tmp /bupdir/latest/
+    actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
+    WVPASSEQ "$actual" ".
 ./a
 ./b
 ./sub
@@ -756,85 +754,88 @@ $D/
 ./sub/foo/a"
 
     WVSTART "index --exclude-rx '/foo/$' (dir, tail anchor)"
-    rm -rf "$D" "$BUP_DIR" buprestore.tmp
+    WVPASS rm -rf "$D" "$BUP_DIR" buprestore.tmp
     WVPASS bup init
-    mkdir $D
-    touch $D/a
-    touch $D/b
-    touch $D/foo
-    mkdir $D/sub
-    mkdir $D/sub/foo
-    touch $D/sub/foo/a
+    WVPASS mkdir $D
+    WVPASS touch $D/a
+    WVPASS touch $D/b
+    WVPASS touch $D/foo
+    WVPASS mkdir $D/sub
+    WVPASS mkdir $D/sub/foo
+    WVPASS touch $D/sub/foo/a
     WVPASS bup index -u $D --exclude-rx '/foo/$'
-    bup save --strip -n bupdir $D
-    bup restore -C buprestore.tmp /bupdir/latest/
-    WVPASSEQ "$(cd buprestore.tmp && find . | sort)" ".
+    WVPASS bup save --strip -n bupdir $D
+    WVPASS bup restore -C buprestore.tmp /bupdir/latest/
+    actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
+    WVPASSEQ "$actual" ".
 ./a
 ./b
 ./foo
 ./sub"
 
     WVSTART "index --exclude-rx '/foo/.' (dir content)"
-    rm -rf "$D" "$BUP_DIR" buprestore.tmp
+    WVPASS rm -rf "$D" "$BUP_DIR" buprestore.tmp
     WVPASS bup init
-    mkdir $D
-    touch $D/a
-    touch $D/b
-    touch $D/foo
-    mkdir $D/sub
-    mkdir $D/sub/foo
-    touch $D/sub/foo/a
+    WVPASS mkdir $D
+    WVPASS touch $D/a
+    WVPASS touch $D/b
+    WVPASS touch $D/foo
+    WVPASS mkdir $D/sub
+    WVPASS mkdir $D/sub/foo
+    WVPASS touch $D/sub/foo/a
     WVPASS bup index -u $D --exclude-rx '/foo/.'
-    bup save --strip -n bupdir $D
-    bup restore -C buprestore.tmp /bupdir/latest/
-    WVPASSEQ "$(cd buprestore.tmp && find . | sort)" ".
+    WVPASS bup save --strip -n bupdir $D
+    WVPASS bup restore -C buprestore.tmp /bupdir/latest/
+    actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
+    WVPASSEQ "$actual" ".
 ./a
 ./b
 ./foo
 ./sub
 ./sub/foo"
-) || WVFAIL
+) || exit $?
 
 
 # bup restore --exclude-rx ...
 (
-    set -e
     export BUP_DIR="$TOP/buptest.tmp"
     D=bupdata.tmp
 
     WVSTART "restore --exclude-rx '^/foo' (root anchor)"
-    rm -rf "$D" "$BUP_DIR" buprestore.tmp
+    WVPASS rm -rf "$D" "$BUP_DIR" buprestore.tmp
     WVPASS bup init
-    mkdir $D
-    touch $D/a
-    touch $D/b
-    mkdir $D/sub1
-    mkdir $D/sub2
-    touch $D/sub1/a
-    touch $D/sub2/b
+    WVPASS mkdir $D
+    WVPASS touch $D/a
+    WVPASS touch $D/b
+    WVPASS mkdir $D/sub1
+    WVPASS mkdir $D/sub2
+    WVPASS touch $D/sub1/a
+    WVPASS touch $D/sub2/b
     WVPASS bup index -u $D
-    bup save --strip -n bupdir $D
-    bup restore -C buprestore.tmp --exclude-rx "^/sub1/" /bupdir/latest/
-    WVPASSEQ "$(cd buprestore.tmp && find . | sort)" ".
+    WVPASS bup save --strip -n bupdir $D
+    WVPASS bup restore -C buprestore.tmp --exclude-rx "^/sub1/" /bupdir/latest/
+    actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
+    WVPASSEQ "$actual" ".
 ./a
 ./b
 ./sub2
 ./sub2/b"
 
     WVSTART "restore --exclude-rx '/foo$' (non-dir, tail anchor)"
-    rm -rf "$D" "$BUP_DIR" buprestore.tmp
+    WVPASS rm -rf "$D" "$BUP_DIR" buprestore.tmp
     WVPASS bup init
-    mkdir $D
-    touch $D/a
-    touch $D/b
-    touch $D/foo
-    mkdir $D/sub
-    mkdir $D/sub/foo
-    touch $D/sub/foo/a
+    WVPASS mkdir $D
+    WVPASS touch $D/a
+    WVPASS touch $D/b
+    WVPASS touch $D/foo
+    WVPASS mkdir $D/sub
+    WVPASS mkdir $D/sub/foo
+    WVPASS touch $D/sub/foo/a
     WVPASS bup index -u $D
-    bup save --strip -n bupdir $D
-    bup restore -C buprestore.tmp --exclude-rx '/foo$' /bupdir/latest/
-    WVPASSEQ "$(cd buprestore.tmp && find . | sort)" ".
+    WVPASS bup save --strip -n bupdir $D
+    WVPASS bup restore -C buprestore.tmp --exclude-rx '/foo$' /bupdir/latest/
+    actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
+    WVPASSEQ "$actual" ".
 ./a
 ./b
 ./sub
@@ -842,41 +843,43 @@ $D/
 ./sub/foo/a"
 
     WVSTART "restore --exclude-rx '/foo/$' (dir, tail anchor)"
-    rm -rf "$D" "$BUP_DIR" buprestore.tmp
+    WVPASS rm -rf "$D" "$BUP_DIR" buprestore.tmp
     WVPASS bup init
-    mkdir $D
-    touch $D/a
-    touch $D/b
-    touch $D/foo
-    mkdir $D/sub
-    mkdir $D/sub/foo
-    touch $D/sub/foo/a
+    WVPASS mkdir $D
+    WVPASS touch $D/a
+    WVPASS touch $D/b
+    WVPASS touch $D/foo
+    WVPASS mkdir $D/sub
+    WVPASS mkdir $D/sub/foo
+    WVPASS touch $D/sub/foo/a
     WVPASS bup index -u $D
-    bup save --strip -n bupdir $D
-    bup restore -C buprestore.tmp --exclude-rx '/foo/$' /bupdir/latest/
-    WVPASSEQ "$(cd buprestore.tmp && find . | sort)" ".
+    WVPASS bup save --strip -n bupdir $D
+    WVPASS bup restore -C buprestore.tmp --exclude-rx '/foo/$' /bupdir/latest/
+    actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
+    WVPASSEQ "$actual" ".
 ./a
 ./b
 ./foo
 ./sub"
 
     WVSTART "restore --exclude-rx '/foo/.' (dir content)"
-    rm -rf "$D" "$BUP_DIR" buprestore.tmp
+    WVPASS rm -rf "$D" "$BUP_DIR" buprestore.tmp
     WVPASS bup init
-    mkdir $D
-    touch $D/a
-    touch $D/b
-    touch $D/foo
-    mkdir $D/sub
-    mkdir $D/sub/foo
-    touch $D/sub/foo/a
+    WVPASS mkdir $D
+    WVPASS touch $D/a
+    WVPASS touch $D/b
+    WVPASS touch $D/foo
+    WVPASS mkdir $D/sub
+    WVPASS mkdir $D/sub/foo
+    WVPASS touch $D/sub/foo/a
     WVPASS bup index -u $D
-    bup save --strip -n bupdir $D
-    bup restore -C buprestore.tmp --exclude-rx '/foo/.' /bupdir/latest/
-    WVPASSEQ "$(cd buprestore.tmp && find . | sort)" ".
+    WVPASS bup save --strip -n bupdir $D
+    WVPASS bup restore -C buprestore.tmp --exclude-rx '/foo/.' /bupdir/latest/
+    actual="$(WVPASS cd buprestore.tmp; WVPASS find . | WVPASS sort)" || exit $?
+    WVPASSEQ "$actual" ".
 ./a
 ./b
 ./foo
 ./sub
 ./sub/foo"
-) || WVFAIL
+) || exit $?
index 2529da3ad0dd96a8715317da44317bf52065fb97..d7f0b48f5dfd4dfb4819de87829703a57315102b 100644 (file)
@@ -8,17 +8,15 @@
 _wvtop="$(pwd)"
 
 wvmktempdir ()
-(
-    script_name="$(basename $0)"
-    set -e -o pipefail
-    mkdir -p "$_wvtop/t/tmp"
-    mktemp -d "$_wvtop/t/tmp/$script_name-XXXXXXX"
-)
+{
+    local script_name="$(basename $0)"
+    mkdir -p "$_wvtop/t/tmp" || exit $?
+    mktemp -d "$_wvtop/t/tmp/$script_name-XXXXXXX" || exit $?
+}
 
 wvmkmountpt ()
-(
-    script_name="$(basename $0)"
-    set -e -o pipefail
-    mkdir -p "$_wvtop/t/mnt"
-    mktemp -d "$_wvtop/t/mnt/$script_name-XXXXXXX"
-)
+{
+    local script_name="$(basename $0)"
+    mkdir -p "$_wvtop/t/mnt" || exit $?
+    mktemp -d "$_wvtop/t/mnt/$script_name-XXXXXXX" || exit $?
+}