]> arthur.barton.de Git - bup.git/commitdiff
Move the main fsck tests from test.sh to test-fsck.sh.
authorRob Browning <rlb@defaultvalue.org>
Tue, 31 Dec 2013 19:58:53 +0000 (13:58 -0600)
committerRob Browning <rlb@defaultvalue.org>
Tue, 31 Dec 2013 19:58:53 +0000 (13:58 -0600)
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Makefile
t/test-fsck.sh [new file with mode: 0755]
t/test.sh

index 825ef563ab961f95e9abcd07caab204546e321fa..2835005b2218fcd2441a507c125d7331531d5a7b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -90,6 +90,7 @@ runtests-cmdline: all
        test -e t/tmp || mkdir t/tmp
        TMPDIR="$(test_tmp)" t/test-cat-file.sh
        TMPDIR="$(test_tmp)" t/test-compression.sh
+       TMPDIR="$(test_tmp)" t/test-fsck.sh
        TMPDIR="$(test_tmp)" t/test-index-clear.sh
        TMPDIR="$(test_tmp)" t/test-index-check-device.sh
        TMPDIR="$(test_tmp)" t/test-meta.sh
diff --git a/t/test-fsck.sh b/t/test-fsck.sh
new file mode 100755 (executable)
index 0000000..48751cd
--- /dev/null
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+. ./wvtest-bup.sh
+
+set -o pipefail
+
+top="$(WVPASS pwd)" || exit $?
+tmpdir="$(WVPASS wvmktempdir)" || exit $?
+
+export BUP_DIR="$tmpdir/bup"
+export GIT_DIR="$tmpdir/bup"
+
+bup() { "$top/bup" "$@"; }
+
+WVPASS bup init
+WVPASS cd "$tmpdir"
+
+WVSTART "fsck"
+
+WVPASS bup index "$top"
+WVPASS bup save -n fsck-test "$top/lib"
+WVPASS bup save -n fsck-test "$top/Documentation"
+WVPASS bup save -n fsck-test "$top/cmd"
+WVPASS bup fsck
+WVPASS bup fsck --quick
+if bup fsck --par2-ok; then
+    WVSTART "fsck (par2)"
+else
+    WVSTART "fsck (PAR2 IS MISSING)"
+fi
+WVPASS bup fsck -g
+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
+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
+WVFAIL bup fsck --quick
+WVFAIL bup fsck --quick -rvv -j99   # fails because repairs were needed
+if bup fsck --par2-ok; then
+    WVPASS bup fsck -r # ok because of repairs from last time
+    WVPASS bup damage "$BUP_DIR"/objects/pack/*.pack -n202 -s1 --equal -S0
+    WVFAIL bup fsck
+    WVFAIL bup fsck -rvv   # too many errors to be repairable
+    WVFAIL bup fsck -r   # too many errors to be repairable
+else
+    WVFAIL bup fsck --quick -r # still fails because par2 was missing
+fi
+
+
+WVPASS rm -rf "$tmpdir"
index 0bae1e3181e3b0f522a5414b3e9d0980f3c27eaf..2a80e7b5a7f4204108d80e8f53ef567f35153c30 100755 (executable)
--- a/t/test.sh
+++ b/t/test.sh
@@ -303,36 +303,6 @@ WVPASS bup tag -d v0.1
 WVPASS bup tag -f -d v0.1
 WVFAIL bup tag -d v0.1
 
-# This section destroys data in the bup repository, so it is done last.
-WVSTART "fsck"
-WVPASS bup fsck
-WVPASS bup fsck --quick
-if bup fsck --par2-ok; then
-    WVSTART "fsck (par2)"
-else
-    WVSTART "fsck (PAR2 IS MISSING)"
-fi
-WVPASS bup fsck -g
-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
-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
-WVFAIL bup fsck --quick
-WVFAIL bup fsck --quick -rvv -j99   # fails because repairs were needed
-if bup fsck --par2-ok; then
-    WVPASS bup fsck -r # ok because of repairs from last time
-    WVPASS bup damage $BUP_DIR/objects/pack/*.pack -n202 -s1 --equal -S0
-    WVFAIL bup fsck
-    WVFAIL bup fsck -rvv   # too many errors to be repairable
-    WVFAIL bup fsck -r   # too many errors to be repairable
-else
-    WVFAIL bup fsck --quick -r # still fails because par2 was missing
-fi
-
 
 WVSTART "save (no index)"
 (