]> arthur.barton.de Git - bup.git/commitdiff
Add "set -eo pipefail" to "exclude" and "exclude-from" tests.
authorRob Browning <rlb@defaultvalue.org>
Sun, 17 Mar 2013 17:23:32 +0000 (12:23 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 17 Mar 2013 17:31:54 +0000 (12:31 -0500)
Don't allow non-tests to silently fail (i.e. mkdir, touch, echo, rm,
etc.).  Eventually all test code should have similar behavior.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
t/test.sh

index f1c414286e6e5aecb6bdc411becb2613a6267596..afa38f0c621a726952c2fb824e462cf20cc3cdd1 100755 (executable)
--- a/t/test.sh
+++ b/t/test.sh
@@ -354,53 +354,58 @@ d/
 f"
 
 WVSTART "exclude"
-D=exclude.tmp
-force-delete $D
-mkdir $D
-export BUP_DIR="$D/.bup"
-WVPASS bup init
-touch $D/a
-WVPASS bup random 128k >$D/b
-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
-WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a
+(
+    set -e -o pipefail
+    D=exclude.tmp
+    force-delete $D
+    mkdir $D
+    export BUP_DIR="$D/.bup"
+    WVPASS bup init
+    touch $D/a
+    WVPASS bup random 128k >$D/b
+    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
+    WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a
 b
 f"
-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
-WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a
+    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
+    WVPASSEQ "$(bup ls exclude/latest/$TOP/$D/)" "a
 b
 f"
+) || WVFAIL
 
 WVSTART "exclude-from"
-D=exclude-fromdir.tmp
-EXCLUDE_FILE=exclude-from.tmp
-echo "$D/d 
+(
+    set -e -o pipefail
+    D=exclude-fromdir.tmp
+    EXCLUDE_FILE=exclude-from.tmp
+    echo "$D/d 
  $TOP/$D/g
 $D/h
 $D/i" > $EXCLUDE_FILE
-force-delete $D
-mkdir $D
-export BUP_DIR="$D/.bup"
-WVPASS bup init
-touch $D/a
-WVPASS bup random 128k >$D/b
-mkdir $D/d $D/d/e
-WVPASS bup random 512 >$D/f
-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
-WVPASSEQ "$(bup ls exclude-from/latest/$TOP/$D/)" "a
+    force-delete $D
+    mkdir $D
+    export BUP_DIR="$D/.bup"
+    WVPASS bup init
+    touch $D/a
+    WVPASS bup random 128k >$D/b
+    mkdir $D/d $D/d/e
+    WVPASS bup random 512 >$D/f
+    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
+    WVPASSEQ "$(bup ls exclude-from/latest/$TOP/$D/)" "a
 b
 f"
-rm $EXCLUDE_FILE
-
+    rm $EXCLUDE_FILE
+) || WVFAIL
 
 WVSTART "save (no index)"
 (