def setup_testfs():
assert(sys.platform.startswith('linux'))
# Set up testfs with user_xattr, etc.
+ if subprocess.call(['modprobe', 'loop']) != 0:
+ return False
subprocess.call(['umount', 'testfs'])
ex('dd', 'if=/dev/zero', 'of=testfs.img', 'bs=1M', 'count=32')
ex('mke2fs', '-F', '-j', '-m', '0', 'testfs.img')
# Hide, so that tests can't create risks.
os.chown('testfs', 0, 0)
os.chmod('testfs', 0700)
+ return True
def cleanup_testfs():
if not is_superuser() or detect_fakeroot():
WVMSG('skipping test -- not superuser')
return
- setup_testfs()
+ if not setup_testfs():
+ WVMSG('unable to load loop module; skipping dependent tests')
+ return
for f in glob.glob('testfs/*'):
ex('rm', '-rf', f)
path = 'testfs/foo'
set -o pipefail
+if test -n "$(type -p modprobe)" && ! modprobe fuse; then
+ echo 'Unable to load fuse module; skipping dependent tests.' 1>&2
+ exit 0
+fi
+
if ! fusermount -V; then
echo 'skipping FUSE tests: fusermount does not appear to work'
exit 0
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
# (patches welcome).
[[ $(uname) =~ Linux ]] || exit 0
+ if ! modprobe loop; then
+ echo 'Unable to load loopback module; skipping dependent tests.' 1>&2
+ exit 0
+ fi
+
WVSTART 'meta - general (as root)'
WVPASS setup-test-tree
WVPASS cd "$TOP/bupmeta.tmp"
exit 0 # FIXME: add WVSKIP.
fi
+if ! modprobe loop; then
+ echo 'Unable to load loopback module; skipping dependent tests.' 1>&2
+ exit 0
+fi
+
# These tests are only likely to work under Linux for now
# (patches welcome).
if ! [[ $(uname) =~ Linux ]]; then