diff options
author | Bernd Schubert <bernd.schubert@fastmail.fm> | 2023-09-26 09:49:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-26 08:49:05 +0100 |
commit | 9ca35f454f61df81af9bcb315908819fd2100696 (patch) | |
tree | 60ae6cd3a02ab40d1b836f677810ef8142ab5bd1 /xfstests/mount.fuse.passthrough | |
parent | eb9ccbe7a4c1e84538a9c02cad573f38e6ae750a (diff) | |
download | libfuse-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/mount.fuse.passthrough')
-rwxr-xr-x | xfstests/mount.fuse.passthrough | 37 |
1 files changed, 29 insertions, 8 deletions
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" "$@" |