From: Johannes Berg Date: Sun, 28 Nov 2021 19:49:13 +0000 (+0100) Subject: test-fuse: improve/broaden applicability checks X-Git-Url: https://arthur.barton.de/gitweb/?p=bup.git;a=commitdiff_plain;h=8840a24b8328c961c620565059a913b03f3af3ab test-fuse: improve/broaden applicability checks The 'fuse' group doesn't exist on (most?) modern distros anymore, so checking for it and membership results in not being able to run the tests. Additionally, on some systems (e.g. Fedora) the wrong fuse module is installed (there are at least two competing ones in python with the name 'fuse'), so run 'bup fuse -h' at the beginning of the test just to do the import checks. Signed-off-by: Johannes Berg Reviewed-by: Rob Browning [rlb@defaultvalue.org: rebase onto WVSKIP addition] [rlb@defaultvalue.org: adjust commit summary] Signed-off-by: Rob Browning Tested-by: Rob Browning --- diff --git a/test/ext/test-fuse b/test/ext/test-fuse index bfe04a9..0f25b9e 100755 --- a/test/ext/test-fuse +++ b/test/ext/test-fuse @@ -6,10 +6,15 @@ set -o pipefail unset BLOCKSIZE BLOCK_SIZE DF_BLOCK_SIZE -root_status="$(dev/root-status)" || exit $? +top="$(WVPASS pwd)" || exit $? +bup() { "$top/bup" "$@"; } -if ! bup-python -c 'import fuse' 2> /dev/null; then - WVSKIP 'unable to import fuse; skipping test' +# Note: this relies on the import checks happening first +# before the command-line is evaluated, and us doing an +# exit with status 2 on failures +bup fuse -h 2>/dev/null +if [ $? -eq 2 ]; then + WSKIP 'unable to import fuse/check version; skipping test' exit 0 fi @@ -23,8 +28,8 @@ if ! fusermount -V; then exit 0 fi -if ! groups | grep -q fuse && test "$root_status" != root; then - WVSKIP 'skipping FUSE tests: you are not root and not in the fuse group' +if ! test -w /dev/fuse; then + WVSKIP 'skipping FUSE tests; no access to /dev/fuse' exit 0 fi @@ -39,8 +44,6 @@ tmpdir="$(WVPASS wvmktempdir)" || exit $? export BUP_DIR="$tmpdir/bup" export GIT_DIR="$tmpdir/bup" -bup() { "$top/bup" "$@"; } - # Some versions of bash's printf don't support the relevant date expansion. savename() {