aboutsummaryrefslogtreecommitdiffstats
path: root/xfstests
diff options
context:
space:
mode:
authorBernd Schubert <bernd.schubert@fastmail.fm>2023-09-26 09:49:05 +0200
committerGitHub <noreply@github.com>2023-09-26 08:49:05 +0100
commit9ca35f454f61df81af9bcb315908819fd2100696 (patch)
tree60ae6cd3a02ab40d1b836f677810ef8142ab5bd1 /xfstests
parenteb9ccbe7a4c1e84538a9c02cad573f38e6ae750a (diff)
downloadlibfuse-9ca35f454f61df81af9bcb315908819fd2100696.tar.gz
xfstests example: Use export in local.config and remove comment (#811)
ix passthrough mount helper for running xfstests * The mount helper does not see the env vars exported by xfstests * Use the NFS style format TEST_DEV=source:/$TEST_SOURCE to communicate the sourse path to the mount helper without confusing xfstest * Also recognise when source= is provided in mount options * Support -o remount (e.g. for test generic/306) Signed-off-by: Amir Goldstein <amir73il@gmail.com> Co-authored-by: Bernd Schubert <bschubert@ddn.com> Co-authored-by: Amir Goldstein <amir73il@gmail.com> Co-authored-by: Nikolaus Rath <Nikolaus@rath.org>
Diffstat (limited to 'xfstests')
-rw-r--r--xfstests/local.config16
-rwxr-xr-xxfstests/mount.fuse.passthrough37
2 files changed, 40 insertions, 13 deletions
diff --git a/xfstests/local.config b/xfstests/local.config
index f20cec0..318f12c 100644
--- a/xfstests/local.config
+++ b/xfstests/local.config
@@ -1,12 +1,18 @@
-export TEST_DEV=non1
+export TEST_DEV=source:/mnt/src/test
export TEST_DIR=/mnt/test
-export SCRATCH_DEV=non2
+
+export SCRATCH_DEV=source:/mnt/src/scratch
export SCRATCH_MNT=/mnt/scratch
+
export FSTYP=fuse
export FUSE_SUBTYP=.passthrough
export MOUNT_OPTIONS=""
export TEST_FS_MOUNT_OPTS=""
-PASSTHROUGH_PATH=/home/nikratio/libfuse/build/example/passthrough_hp
-SCRATCH_SOURCE=/mnt/src/scratch
-TEST_SOURCE=/mnt/src/test
+# If PASSTHROUGH_PATH is unset, the mount helper is going to look
+# for the binary '${FUSE_SUBTYP}', though omitting the leading dot '.'.
+# Example:
+# with FUSE_SUBTYP=".passthrough", the mount helper is called
+# 'mount.fuse.passthrough' and that would try to run
+# 'passthrough'.
+# export PASSTHROUGH_PATH=<path-to-libfuse-build>/example/passthrough_hp
diff --git a/xfstests/mount.fuse.passthrough b/xfstests/mount.fuse.passthrough
index 47208f8..b19d27f 100755
--- a/xfstests/mount.fuse.passthrough
+++ b/xfstests/mount.fuse.passthrough
@@ -2,16 +2,37 @@
ulimit -n 1048576
-# It would be easier if we could just set SCRATCH_DEV and TEST_DEV to the source directory
-# path in local.options. Unfortunately, setting these variables to a path seems get
-# xfstests all worked up (even though it should treat these as opaque values), and it
-# refuses to even start running any tests).
dev="$1"
shift
-if [ "$dev" = "${SCRATCH_DEV}" ]; then
- source="${SCRATCH_SOURCE}"
+mnt="$1"
+shift
+# -o
+shift
+mntopts="$1"
+shift
+
+# source can be provided as NFS style device (e.g. TEST_DEV=source:/${TEST_SOURCE})
+# and/or it can already be inside mount options (passthrough_ll style)
+if ( echo "$mntopts" | grep -q "source=" ) ; then
+ # Don't pass source as position argument
+ source=
+elif [[ "$dev" == "source:"* ]]; then
+ source="${dev#"source:"}"
else
- source="${TEST_SOURCE}"
+ >&2 echo "passthrough source is undefined, aborting!"
fi
-exec "$PASSTHROUGH_PATH" -o fsname=$dev,allow_other "${source}" "$@"
+if ( echo "$mntopts" | grep -q remount ) ; then
+ exec mount -i "$dev" "$mnt" -o "$mntopts"
+fi
+
+# set default to SUBTYPE (extracted from this script name)
+# example:
+# Copy or link this script to /sbin/mount.fuse.passthrough_hp
+# If xfstests local.config does not set PASSTHROUGH_PATH,
+# PASSTHROUGH_PATH will be set to 'passthrough_hp' and exec below
+# will look that up from $PATH
+
+[ -n "$PASSTHROUGH_PATH" ] || PASSTHROUGH_PATH=${0#*mount.fuse.}
+
+exec "$PASSTHROUGH_PATH" -o fsname=$dev,allow_other $source "$mnt" -o "$mntopts" "$@"