]> arthur.barton.de Git - bup.git/commitdiff
test-fuse: improve/broaden applicability checks
authorJohannes Berg <johannes@sipsolutions.net>
Sun, 28 Nov 2021 19:49:13 +0000 (20:49 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sun, 5 Dec 2021 20:26:53 +0000 (14:26 -0600)
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 <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: rebase onto WVSKIP addition]
[rlb@defaultvalue.org: adjust commit summary]
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
test/ext/test-fuse

index bfe04a978928fccb859c4ab6efe3574cfed8d77b..0f25b9e9d924756a670c83db89d9428c40100cfc 100755 (executable)
@@ -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()
 {