Skip to contentSkip to conversation

selftests: Add functional test for the abort file in fusectl

PATCH Superseded Chen Linxuan 2 participants 5 messages May 17, 2025 – Jun 3, 2025

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selftests: Add functional test for the abort file in fusectl

This patch add a simple functional test for the "abort" file in fusectlfs (/sys/fs/fuse/connections/ID/about).

A simple fuse daemon is added for testing.

Related discussion can be found in the link below.

---
Changes in v2:
- Apply changes suggested by Amir Goldstein
- Check errno
- Link to v1: https://lore.kernel.org/all/[email protected]/

---
 MAINTAINERS                                   |   1 +
 tools/testing/selftests/Makefile              |   1 +
 .../selftests/filesystems/fusectl/.gitignore  |   3 +
 .../selftests/filesystems/fusectl/Makefile    |  21 +++
 .../selftests/filesystems/fusectl/fuse_mnt.c  | 146 ++++++++++++++++++
 .../filesystems/fusectl/fusectl_test.c        | 116 ++++++++++++++
 6 files changed, 288 insertions(+)
 create mode 100644 tools/testing/selftests/filesystems/fusectl/.gitignore
 create mode 100644 tools/testing/selftests/filesystems/fusectl/Makefile
 create mode 100644 tools/testing/selftests/filesystems/fusectl/fuse_mnt.c
 create mode 100644 tools/testing/selftests/filesystems/fusectl/fusectl_test.c
MAINTAINERS +1 -0
index 3563492e4eba4..bee6f7d787a33 100644
@@ -9740,6 +9740,7 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse.git
 F:	Documentation/filesystems/fuse.rst
 F:	fs/fuse/
 F:	include/uapi/linux/fuse.h
+F:	tools/testing/selftests/filesystems/fusectl
 
 FUTEX SUBSYSTEM
 M:	Thomas Gleixner <[email protected]>
tools/testing/selftests/Makefile +1 -0
index 80fb84fa3cfcb..a9bfefa961889 100644
@@ -36,6 +36,7 @@ TARGETS += filesystems/fat
 TARGETS += filesystems/overlayfs
 TARGETS += filesystems/statmount
 TARGETS += filesystems/mount-notify
+TARGETS += filesystems/fusectl
 TARGETS += firmware
 TARGETS += fpu
 TARGETS += ftrace
tools/testing/selftests/filesystems/fusectl/.gitignore new file +3 -0
new file mode 100644
index 0000000000000..3e72e742d08e8
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0-only
+fuse_mnt
+fusectl_test
tools/testing/selftests/filesystems/fusectl/Makefile new file +21 -0
new file mode 100644
index 0000000000000..612aad69a93aa
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+CFLAGS += -Wall -O2 -g $(KHDR_INCLUDES)
+
+TEST_GEN_PROGS := fusectl_test
+TEST_GEN_FILES := fuse_mnt
+
+include ../../lib.mk
+
+VAR_CFLAGS := $(shell pkg-config fuse --cflags 2>/dev/null)
+ifeq ($(VAR_CFLAGS),)
+VAR_CFLAGS := -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse
+endif
+
+VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)
+ifeq ($(VAR_LDLIBS),)
+VAR_LDLIBS := -lfuse -pthread
+endif
+
+$(OUTPUT)/fuse_mnt: CFLAGS += $(VAR_CFLAGS)
+$(OUTPUT)/fuse_mnt: LDLIBS += $(VAR_LDLIBS)
tools/testing/selftests/filesystems/fusectl/fuse_mnt.c new file +146 -0

146 lines not on this page · raw message

tools/testing/selftests/filesystems/fusectl/fusectl_test.c new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
2.43.0
maintainer Acked-by on v2 1/1
#1 lore raw
Quoted 7 lines · Chen Linxuan

This patch add a simple functional test for the "abort" file in fusectlfs (/sys/fs/fuse/connections/ID/about).

A simple fuse daemon is added for testing.

Related discussion can be found in the link below.

Quoted 8 lines

---
Changes in v2:
- Apply changes suggested by Amir Goldstein
- Check errno
- Link to v1: https://lore.kernel.org/all/[email protected]/

Short summary should include the test name:

selftests: filesystems: Add functional test for the abort file in fusectl

Also if this test requires root previlege, add check for it. The rest looks good to me.

thanks,
-- Shuah

#2 lore raw
Quoted 1 line · Shuah Khan

Also if this test requires root previlege, add check for it.

Currently, this test does not require root privileges.

Thanks,
Chen Linxuan

maintainer Acked-by
#3 lore raw
Quoted 8 lines · Chen Linxuan
Quoted 1 line · Shuah Khan

Also if this test requires root previlege, add check for it.

Currently, this test does not require root privileges.

Thanks,
Chen Linxuan

Thanks. Looks good to me.

thanks,
-- Shuah