[RFC PATCH v2 3/8] selftests/fuse: check that fusectlfs is mounted

Luis Henriques <[email protected]>
Newsgroups dev.linux.lists.fuse-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-kselftest
Message-ID <[email protected]>
The control filesystem for FUSE needs to be mounted for the fusectl_test to
be successfully run.  Skip the test is that is not the case.

Signed-off-by: Luis Henriques <[email protected]>
Reviewed-by: Amir Goldstein <[email protected]>
---
 tools/testing/selftests/filesystems/fuse/fusectl_test.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/testing/selftests/filesystems/fuse/fusectl_test.c b/tools/testing/selftests/filesystems/fuse/fusectl_test.c
index 0d1d012c35ed..2dcfd3ebe0d5 100644
--- a/tools/testing/selftests/filesystems/fuse/fusectl_test.c
+++ b/tools/testing/selftests/filesystems/fuse/fusectl_test.c
@@ -48,6 +48,7 @@ FIXTURE_SETUP(fusectl)
 	uid_t uid = getuid();
 	gid_t gid = getgid();
 	char buf[32];
+	char path_buf[PATH_MAX];
 
 	/* Setup userns */
 	ASSERT_EQ(unshare(CLONE_NEWNS|CLONE_NEWUSER), 0);
@@ -93,6 +94,12 @@ FIXTURE_SETUP(fusectl)
 		     strerror(errno));
 
 	self->connection = statbuf.st_dev;
+
+	sprintf(path_buf, "/sys/fs/fuse/connections/%d", self->connection);
+	if (access(path_buf, F_OK) != 0)
+		SKIP(return,
+		     "fusectl doesn't seem to be mounted: %s\n",
+		     strerror(errno));
 }
 
 FIXTURE_TEARDOWN(fusectl)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.