X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=t%2Ftest-index-check-device.sh;h=a45f8c7e3685d1b0678b25dd894b9ff15efda942;hb=refs%2Fheads%2Funused-variable-do_bloom;hp=2484fd0bd1495db8f7dc2acd51cccbc8dae9e8c0;hpb=51967eaf5ac36ec5f8378810fc23293201e50124;p=bup.git diff --git a/t/test-index-check-device.sh b/t/test-index-check-device.sh index 2484fd0..a45f8c7 100755 --- a/t/test-index-check-device.sh +++ b/t/test-index-check-device.sh @@ -1,10 +1,10 @@ #!/usr/bin/env bash -. ./wvtest-bup.sh -. ./t/lib.sh +. ./wvtest-bup.sh || exit $? +. ./t/lib.sh || exit $? -set -ex -o pipefail +set -o pipefail -if t/root-status != root; then +if [ $(t/root-status) != root ]; then echo 'Not root: skipping --check-device tests.' exit 0 # FIXME: add WVSKIP. fi @@ -22,59 +22,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"