Skip to contentSkip to conversation

lib/test_kmod: do not hardcode/depend on any filesystem

PATCH Applied Herton R. Krzesinski 2 participants 2 messages Apr 18, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 lib/test_kmod: do not hardcode/depend on any filesystem

Right now test_kmod has hardcoded dependencies on btrfs/xfs. That is not optimal since you end up needing to select/build them, but it is not really required since other fs could be selected for the testing. Also, we can't change the default/driver module used for testing on initialization.

Thus make it more generic: introduce two module parameters (start_driver and start_test_fs), which allow to select which modules/fs to use for the testing on test_kmod initialization. Then it's up to the user to select which modules/fs to use for testing based on his config. However, keep test_module as required default.

This way, config/modules becomes selectable as when the testing is done from selftests (userspace).

While at it, also change trigger_config_run_type, since at module initialization we already set the defaults at __kmod_config_init and should not need to do it again in test_kmod_init(), thus we can avoid to again set test_driver/test_fs.

v2: also update tools/testing/selftests/kmod/config with the removed dependencies.

---
 lib/Kconfig.debug                   |  6 ---
 lib/test_kmod.c                     | 64 +++++++++++++++--------------
 tools/testing/selftests/kmod/config |  5 ---
 3 files changed, 34 insertions(+), 41 deletions(-)
lib/Kconfig.debug +0 -6
index 9fe4d8dfe578..1e0f8cbf0365 100644
@@ -2983,13 +2983,7 @@ config TEST_DYNAMIC_DEBUG
 config TEST_KMOD
 	tristate "kmod stress tester"
 	depends on m
-	depends on NETDEVICES && NET_CORE && INET # for TUN
-	depends on BLOCK
-	depends on PAGE_SIZE_LESS_THAN_256KB # for BTRFS
 	select TEST_LKM
-	select XFS_FS
-	select TUN
-	select BTRFS_FS
 	help
 	  Test the kernel's module loading mechanism: kmod. kmod implements
 	  support to load modules using the Linux kernel's usermode helper.
lib/test_kmod.c +34 -30

122 lines not on this page · raw message

tools/testing/selftests/kmod/config +0 -5
index 259f4fd6b5e2..1f1e63494af9 100644
@@ -1,7 +1,2 @@
 CONFIG_TEST_KMOD=m
 CONFIG_TEST_LKM=m
-CONFIG_XFS_FS=m
-
-# For the module parameter force_init_test is used
-CONFIG_TUN=m
-CONFIG_BTRFS_FS=m
Signature · 1 line
2.47.1
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 20 lines · Herton R. Krzesinski

Right now test_kmod has hardcoded dependencies on btrfs/xfs. That is not optimal since you end up needing to select/build them, but it is not really required since other fs could be selected for the testing. Also, we can't change the default/driver module used for testing on initialization.

Thus make it more generic: introduce two module parameters (start_driver and start_test_fs), which allow to select which modules/fs to use for the testing on test_kmod initialization. Then it's up to the user to select which modules/fs to use for testing based on his config. However, keep test_module as required default.

This way, config/modules becomes selectable as when the testing is done from selftests (userspace).

While at it, also change trigger_config_run_type, since at module initialization we already set the defaults at __kmod_config_init and should not need to do it again in test_kmod_init(), thus we can avoid to again set test_driver/test_fs.

Quoted 4 lines

v2: also update tools/testing/selftests/kmod/config with the removed dependencies.

Luis