]> arthur.barton.de Git - bup.git/commitdiff
Set pipefail so that "x | y || exit $?" will work properly.
authorRob Browning <rlb@defaultvalue.org>
Sat, 2 Nov 2013 17:55:49 +0000 (12:55 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 3 Nov 2013 18:57:56 +0000 (12:57 -0600)
Set pipefail so that constructs like this will work properly:

  x | y | z || exit $?

or

  WVPASS x | WVPASS y | WVPASS z || exit $?

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
cmd/import-rdiff-backup-cmd.sh
t/test-cat-file.sh
t/test-command-without-init-fails.sh
t/test-index-check-device.sh
t/test-meta.sh
t/test-redundant-saves.sh
t/test-restore-single-file.sh
t/test-rm-between-index-and-save.sh
t/test.sh

index 98dd21bef765cdcb2e1d8ea17332d7453dcdbe9a..b86404df481daa6475f833561003226b1ac4833e 100755 (executable)
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+set -o pipefail
+
 must() {
     local file=${BASH_SOURCE[0]}
     local line=${BASH_LINENO[0]}
index f0d7ebe30e4fce64a31d9201174ef5416e750256..c8d148a728e98642703e7a7ce2c485a7ed5d737e 100755 (executable)
@@ -1,6 +1,8 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh
 
+set -o pipefail
+
 top="$(WVPASS pwd)" || exit $?
 tmpdir="$(WVPASS wvmktempdir)" || exit $?
 
index 3c5a0cd050c7545b9aed7fc638e9d12550941815..2294bdffa0c0803bcfd6777f68f2cc3a1e31591c 100755 (executable)
@@ -1,6 +1,8 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh
 
+set -o pipefail
+
 WVSTART 'all'
 
 top="$(WVPASS pwd)" || exit $?
index 08b2aa7ebe0dbbadfc5acffd404062db63875e10..23dbb772bd371d55f760603b59ee25b6f6a70410 100755 (executable)
@@ -2,6 +2,8 @@
 . ./wvtest-bup.sh
 . ./t/lib.sh
 
+set -o pipefail
+
 if [ $(t/root-status) != root ]; then
     echo 'Not root: skipping --check-device tests.'
     exit 0 # FIXME: add WVSKIP.
index 879e108904fbb0923cd7c594f37b22ebaf8aaeb4..bb0cdefaa8ee744ccfd75577127aa23bcc9ce481 100755 (executable)
@@ -2,7 +2,9 @@
 . wvtest.sh
 . t/lib.sh
 
-TOP="$(pwd)"
+set -o pipefail
+
+TOP="$(WVPASS pwd)" || exit $?
 export BUP_DIR="$TOP/buptest.tmp"
 
 bup()
index 145994ad3fa70571514518819ea774019b5ca4a7..d8cceacb6763c6a62f1ba69339fab3de041af382 100755 (executable)
@@ -11,6 +11,8 @@
 
 . ./wvtest-bup.sh
 
+set -o pipefail
+
 WVSTART 'all'
 
 top="$(pwd)"
index 86df67f32d89d9d09991724a5f0b08e47380ee7d..c67701beb0375766fd169df113266e213e4d61c5 100755 (executable)
@@ -1,6 +1,8 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh
 
+set -o pipefail
+
 WVSTART 'all'
 
 top="$(WVPASS pwd)" || exit $?
index ce03befd71d1134de5677fa8fa894c46546c71fb..31b6f3b43fa396a9776708689189bb8818641568 100755 (executable)
@@ -1,6 +1,8 @@
 #!/usr/bin/env bash
 . ./wvtest-bup.sh
 
+set -o pipefail
+
 top="$(WVPASS pwd)" || exit $?
 tmpdir="$(WVPASS wvmktempdir)" || exit $?
 export BUP_DIR="$tmpdir/bup"
index 3f96ab005a80d9d835d8c344029d0d848f057492..7f7a2e066c102d5a4faffbae0863bae821f37994 100755 (executable)
--- a/t/test.sh
+++ b/t/test.sh
@@ -2,6 +2,8 @@
 . wvtest.sh
 . t/lib.sh
 
+set -o pipefail
+
 TOP="$(WVPASS /bin/pwd)" || exit $?
 export BUP_DIR="$TOP/buptest.tmp"
 
@@ -165,7 +167,8 @@ WVPASS bup split -t t/testfile2 --fanout 3 >tags2tf.tmp
 WVPASS bup split -r "$BUP_DIR" -c t/testfile2 >tags2c.tmp
 WVPASS bup split -r :$BUP_DIR -c t/testfile2 >tags2c.tmp
 WVPASS ls -lR \
-   | WVPASS bup split -r :$BUP_DIR -c --fanout 3 --max-pack-objects 3 -n lslr
+    | WVPASS bup split -r :$BUP_DIR -c --fanout 3 --max-pack-objects 3 -n lslr \
+    || exit $?
 WVPASS bup ls
 WVFAIL bup ls /does-not-exist
 WVPASS bup ls /lslr
@@ -212,7 +215,7 @@ WVSTART "save/git-fsck"
     (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)' |
+        WVFAIL egrep -v 'dangling (commit|tree|blob)' |
         WVPASS tee -a /dev/stderr |
         WVPASS wc -l) || exit $?
     WVPASS [ "$n" -eq 0 ]