aboutsummaryrefslogtreecommitdiffstats
path: root/xfstests
diff options
context:
space:
mode:
authorNikolaus Rath <Nikolaus@rath.org>2023-03-17 09:56:55 +0000
committerNikolaus Rath <Nikolaus@rath.org>2023-05-12 23:29:03 +0100
commit4c177c904778c45ebd992b7f651af4f0039c550c (patch)
tree7d8405daf0fcca86d83ad502610b69a3387ec3f2 /xfstests
parentad1abf3f2e15d9d23d0a2c60aec6a011762ccfa6 (diff)
downloadlibfuse-4c177c904778c45ebd992b7f651af4f0039c550c.tar.gz
Add support for running xfstests.
Diffstat (limited to 'xfstests')
-rw-r--r--xfstests/README.md18
-rw-r--r--xfstests/local.config12
-rwxr-xr-xxfstests/mount.fuse.passthrough17
3 files changed, 47 insertions, 0 deletions
diff --git a/xfstests/README.md b/xfstests/README.md
new file mode 100644
index 0000000..deda553
--- /dev/null
+++ b/xfstests/README.md
@@ -0,0 +1,18 @@
+To test FUSE with xfstests¹:
+
+1. copy the `mount.fuse.passthrough` file into
+ `/sbin` and edit the `PASSTHROUGH_PATH`, `SCRATCH_SOURCE` and `TEST_SOURCE` variables as needed.
+
+2. Make sure that the `SCRATCH_SOURCE` and `TEST_SOURCE` directories
+exist.
+
+3. Copy `local.config` into your xfstests directory
+
+Tests can then be run with e.g.:
+
+```sh
+# make
+# sudo ./check -fuse -b
+```
+
+¹https://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git/about/
diff --git a/xfstests/local.config b/xfstests/local.config
new file mode 100644
index 0000000..f20cec0
--- /dev/null
+++ b/xfstests/local.config
@@ -0,0 +1,12 @@
+export TEST_DEV=non1
+export TEST_DIR=/mnt/test
+export SCRATCH_DEV=non2
+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
diff --git a/xfstests/mount.fuse.passthrough b/xfstests/mount.fuse.passthrough
new file mode 100755
index 0000000..47208f8
--- /dev/null
+++ b/xfstests/mount.fuse.passthrough
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+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}"
+else
+ source="${TEST_SOURCE}"
+fi
+
+exec "$PASSTHROUGH_PATH" -o fsname=$dev,allow_other "${source}" "$@"