X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=t%2Ftest-index-check-device.sh;h=88a966a330dff54b2ddf148e40b91482c1536c59;hb=51476a384daabaa6e2700859d2e4863ec7ca0284;hp=08b2aa7ebe0dbbadfc5acffd404062db63875e10;hpb=0e18f9a22a52fd3a73a83c9a8122fadb790510f9;p=bup.git diff --git a/t/test-index-check-device.sh b/t/test-index-check-device.sh index 08b2aa7..88a966a 100755 --- a/t/test-index-check-device.sh +++ b/t/test-index-check-device.sh @@ -1,19 +1,28 @@ #!/usr/bin/env bash -. ./wvtest-bup.sh -. ./t/lib.sh +. ./wvtest-bup.sh || exit $? +. ./t/lib.sh || exit $? -if [ $(t/root-status) != root ]; then +set -o pipefail + +root_status="$(t/root-status)" || exit $? + +if [ "$root_status" != root ]; then echo 'Not root: skipping --check-device tests.' exit 0 # FIXME: add WVSKIP. fi +if test -n "$(type -p modprobe)" && ! modprobe loop; then + echo 'Unable to load loopback module; skipping --check-device test.' 1>&2 + exit 0 +fi + if test -z "$(type -p losetup)"; then - echo 'Unable to find losetup: skipping --check-device tests.' + echo 'Unable to find losetup: skipping --check-device tests.' 1>&2 exit 0 # FIXME: add WVSKIP. fi if test -z "$(type -p mke2fs)"; then - echo 'Unable to find mke2fs: skipping --check-device tests.' + echo 'Unable to find mke2fs: skipping --check-device tests.' 1>&2 exit 0 # FIXME: add WVSKIP. fi @@ -44,8 +53,9 @@ WVPASS date > "$tmpmnt1/foo" WVPASS umount "$tmpmnt1" # Mount twice, so we'll have the same content with different devices. +WVPASS cp -pP testfs.img testfs2.img WVPASS mount -oro,loop testfs.img "$tmpmnt1" -WVPASS mount -oro,loop testfs.img "$tmpmnt2" +WVPASS mount -oro,loop testfs2.img "$tmpmnt2" # Test default behavior: --check-device. WVPASS mount -oro --bind "$tmpmnt1" "$srcmnt"