Skip to contentSkip to conversation

selftests/filesystems: Move file_stressor to dedicated subdirectory

PATCH Superseded Disha Goel 2 participants 4 messages May 19 – May 21

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Disha Goel

author
#0 lore raw

PATCH 1/1 selftests/filesystems: Move file_stressor to dedicated subdirectory

The file_stressor test requires a 30-minute timeout (1800 seconds) due to its 15-minute runtime plus setup/teardown overhead. This is significantly longer than the default 45-second timeout used by other filesystem tests.

Move file_stressor into its own subdirectory (filesystems/file_stressor/) with a dedicated settings file to isolate its timeout configuration. This prevents the long timeout from affecting other fast-running tests in the filesystems/ directory.

Changes:
- Move file_stressor.c to filesystems/file_stressor/
- Create filesystems/file_stressor/Makefile for build configuration
- Create filesystems/file_stressor/settings with timeout=1800
- Remove file_stressor from filesystems/Makefile TEST_GEN_PROGS
- Add filesystems/file_stressor to top-level TARGETS in selftests/Makefile

---
 tools/testing/selftests/Makefile                            | 1 +
 tools/testing/selftests/filesystems/Makefile                | 2 +-
 tools/testing/selftests/filesystems/file_stressor/Makefile  | 6 ++++++
 .../filesystems/{ => file_stressor}/file_stressor.c         | 0
 tools/testing/selftests/filesystems/file_stressor/settings  | 3 +++
 5 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/filesystems/file_stressor/Makefile
 rename tools/testing/selftests/filesystems/{ => file_stressor}/file_stressor.c (100%)
 create mode 100644 tools/testing/selftests/filesystems/file_stressor/settings
tools/testing/selftests/Makefile +1 -0
index 6e59b8f63e41..d87fafc6aef6 100644
@@ -34,6 +34,7 @@ TARGETS += filesystems
 TARGETS += filesystems/binderfs
 TARGETS += filesystems/epoll
 TARGETS += filesystems/fat
+TARGETS += filesystems/file_stressor
 TARGETS += filesystems/overlayfs
 TARGETS += filesystems/statmount
 TARGETS += filesystems/mount-notify
tools/testing/selftests/filesystems/Makefile +1 -1
index 85427d7f19b9..7d342755aa3f 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 
 CFLAGS += $(KHDR_INCLUDES)
-TEST_GEN_PROGS := devpts_pts file_stressor anon_inode_test kernfs_test fclog
+TEST_GEN_PROGS := devpts_pts anon_inode_test kernfs_test fclog
 TEST_GEN_PROGS_EXTENDED := dnotify_test
 
 include ../lib.mk
tools/testing/selftests/filesystems/file_stressor/Makefile new file +6 -0
new file mode 100644
index 000000000000..88c8231ac144
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+
+CFLAGS += $(KHDR_INCLUDES)
+TEST_GEN_PROGS := file_stressor
+
+include ../../lib.mk
tools/testing/selftests/filesystems/file_stressor/file_stressor.c renamed from tools/testing/selftests/filesystems/file_stressor.c +0 -0
similarity index 100%
rename from tools/testing/selftests/filesystems/file_stressor.c
rename to tools/testing/selftests/filesystems/file_stressor/file_stressor.c
tools/testing/selftests/filesystems/file_stressor/settings new file +3 -0
new file mode 100644
index 000000000000..b675ca93f936
@@ -0,0 +1,3 @@
+# Timeout for file_stressor test
+# The test runs for 900 seconds (15 minutes) plus setup/teardown time
+timeout=1800
Signature · 1 line
2.45.1
author
#1 lore raw

PATCH 1/1 selftests/filesystems: allow security.selinux xattr in listxattr kernfs test

kernfs_test assumes that flistxattr() on /sys/kernel/warn_count always returns an empty list. However, systems with SELinux enabled may expose security.selinux xattr via listxattr() during policy load, which makes the test fail even though kernfs is behaving correctly.

Allow security.selinux xattr in kernfs_listxattr while continuing to reject other unexpected xattrs. Keep the existing user.foo getxattr check unchanged.

This avoids false failures on SELinux-enabled systems while preserving the original purpose of the test.

---
 .../selftests/filesystems/kernfs_test.c       | 27 +++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)
tools/testing/selftests/filesystems/kernfs_test.c +25 -2
index 84c2b910a60d..a5e480d662e0 100644
@@ -4,6 +4,8 @@
 
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/stat.h>
 #include <sys/xattr.h>
 
@@ -12,12 +14,33 @@
 
 TEST(kernfs_listxattr)
 {
+	char *buf, *xattr;
+	ssize_t len, ret;
 	int fd;
 
-	/* Read-only file that can never have any extended attributes set. */
+	/* Read-only file that can never have any extended attributes set.
+	 * However, SELinux may set security.selinux xattr on kernfs files
+	 * during policy load, so we explicitly ignore it.
+	 */
 	fd = open("/sys/kernel/warn_count", O_RDONLY | O_CLOEXEC);
 	ASSERT_GE(fd, 0);
-	ASSERT_EQ(flistxattr(fd, NULL, 0), 0);
+
+	len = flistxattr(fd, NULL, 0);
+	ASSERT_GE(len, 0);
+
+	if (len > 0) {
+		buf = malloc(len);
+		ASSERT_NE(buf, NULL);
+
+		ret = flistxattr(fd, buf, len);
+		ASSERT_EQ(ret, len);
+
+		for (xattr = buf; xattr < buf + len; xattr += strlen(xattr) + 1)
+			ASSERT_EQ(strcmp(xattr, "security.selinux"), 0);
+
+		free(buf);
+	}
+
 	EXPECT_EQ(close(fd), 0);
 }
 
Signature · 1 line
2.45.1
#2 lore raw
In reply to Disha Goel
kernel test robot noticed the following build warnings:

Hi Disha,

kernel test robot noticed the following build warnings:

[auto build test WARNING on shuah-kselftest/next]
[also build test WARNING on shuah-kselftest/fixes linus/master v7.1-rc4 next-20260518] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Disha-Goel/selftests-filesystems-Move-file_stressor-to-dedicated-subdirectory/20260519-185602
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
patch link:    https://lore.kernel.org/r/20260519104210.11836-1-disgoel%40linux.ibm.com
patch subject: [PATCH] selftests/filesystems: Move file_stressor to dedicated subdirectory
config: m68k-allnoconfig (https://download.01.org/0day-ci/archive/20260519/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260519/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

Documentation/.renames.txt: warning: ignored by one of the .gitignore files

>> tools/testing/selftests/filesystems/file_stressor/Makefile: warning: ignored by one of the .gitignore files
>> tools/testing/selftests/filesystems/file_stressor/file_stressor.c: warning: ignored by one of the .gitignore files
>> tools/testing/selftests/filesystems/file_stressor/settings: warning: ignored by one of the .gitignore files

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

author
#3 lore raw
Quoted 18 lines · kernel test robot

Hi Disha,

kernel test robot noticed the following build warnings:

[auto build test WARNING on shuah-kselftest/next]
[also build test WARNING on shuah-kselftest/fixes linus/master v7.1-rc4 next-20260518] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Disha-Goel/selftests-filesystems-Move-file_stressor-to-dedicated-subdirectory/20260519-185602
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git next
patch link:    https://lore.kernel.org/r/20260519104210.11836-1-disgoel%40linux.ibm.com
patch subject: [PATCH] selftests/filesystems: Move file_stressor to dedicated subdirectory
config: m68k-allnoconfig (https://download.01.org/0day-ci/archive/20260519/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260519/[email protected]/reproduce)
Quoted 11 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

Documentation/.renames.txt: warning: ignored by one of the .gitignore files

Quoted 3 lines
Quoted 3 lines

tools/testing/selftests/filesystems/file_stressor/Makefile: warning: ignored by one of the .gitignore files tools/testing/selftests/filesystems/file_stressor/file_stressor.c: warning: ignored by one of the .gitignore files tools/testing/selftests/filesystems/file_stressor/settings: warning: ignored by one of the .gitignore files

Thanks for the report. This has been fixed in v2.

Quoted 4 lines

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Signature · 2 lines
Regards,
Disha