sysctl: kselftests: fix test_modprobe issue
Subsystems (2)
PATCH v2 1/1 sysctl: kselftests: fix test_modprobe issue
when CONFIG_TEST_SYSCTL=y, there is no "/sys/module/test_sysctl/" when CONFIG_TEST_SYSCTL=m, checking /sys/module/test_sysctl/ is before kernel module loading
you'll get below error message
root@intel-x86-64:/tmp/sysctl# ./sysctl.sh Checking production write strict setting ... ok ./sysctl.sh: /sys/module/test_sysctl/ not present You must have the following enabled in your kernel:
This patch will fix this issue.
when CONFIG_TEST_SYSCTL=y, it has no chance to check "/sys/module/test_sysctl/" when CONFIG_TEST_SYSCTL=m, it will load kernel module first before checking sys interface.
--- tools/testing/selftests/sysctl/sysctl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/sysctl/sysctl.sh +1 -1
@@ -120,6 +120,7 @@ test_reqs() function load_req_mod() { + trap "test_modprobe" EXIT if [ ! -d $DIR ]; then if ! modprobe -q -n $TEST_DRIVER; then echo "$0: module $TEST_DRIVER not found [SKIP]"
@@ -770,7 +771,6 @@ function parse_args() test_reqs allow_user_defaults check_production_sysctl_writes_strict -test_modprobe load_req_mod trap "test_finish" EXIT
Signature · 1 line
1.9.1
Quoted 42 lines · Lei Yang
when
CONFIG_TEST_SYSCTL=y, there is no "/sys/module/test_sysctl/" whenCONFIG_TEST_SYSCTL=m, checking/sys/module/test_sysctl/is before kernel module loadingyou'll get below error message
root at intel-x86-64:/tmp/sysctl# ./sysctl.sh Checking production write strict setting ... ok ./sysctl.sh:/sys/module/test_sysctl/not present You must have the following enabled in your kernel:This patch will fix this issue.
whenCONFIG_TEST_SYSCTL=y, it has no chance to check "/sys/module/test_sysctl/" whenCONFIG_TEST_SYSCTL=m, it will load kernel module first before checking sys interface.Signed-off-by Lei Yang <Lei.Yang at windriver.com>--- tools/testing/selftests/sysctl/sysctl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/sysctl/sysctl.sh +1
-2@@ -120,6 +120,7 @@ test_reqs() function load_req_mod() { + trap "test_modprobe" EXIT if [ ! -d $DIR ]; then if ! modprobe -q -n $TEST_DRIVER; then echo "$0: module $TEST_DRIVER not found [SKIP]"@@ -770,7 +771,6 @@ function parse_args() test_reqs allow_user_defaults check_production_sysctl_writes_strict -test_modprobe load_req_mod trap "test_finish" EXIT --
Quoted 2 lines
1.9.1
do we really nead the test_modprobe function?
I think we can just remove that completely.
Also remove a lot in load_req_mod and only do: modprobe $TEST_DRIVER if it fails its a non fatal error and we can go on and have a new function in all
the tests sysctl_test_000(1|2|3|4|5) that checks for the files. Maybe do something like this:
(quoted diff) +0 -0
b/tools/testing/selftests/sysctl/sysctl.sh
index 584eb8ea780a..a925d040dfe0 100755
tools/testing/selftests/sysctl/sysctl.sh +14 -27
106 lines not on this page · raw message
Cheers,
Anders
Quoted 33 lines · Lei Yang
when
CONFIG_TEST_SYSCTL=y, there is no "/sys/module/test_sysctl/" whenCONFIG_TEST_SYSCTL=m, checking/sys/module/test_sysctl/is before kernel module loadingyou'll get below error message
root at intel-x86-64:/tmp/sysctl# ./sysctl.sh Checking production write strict setting ... ok ./sysctl.sh:/sys/module/test_sysctl/not present You must have the following enabled in your kernel:This patch will fix this issue.
whenCONFIG_TEST_SYSCTL=y, it has no chance to check "/sys/module/test_sysctl/" whenCONFIG_TEST_SYSCTL=m, it will load kernel module first before checking sys interface.Signed-off-by Lei Yang <Lei.Yang at windriver.com>--- tools/testing/selftests/sysctl/sysctl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/testing/selftests/sysctl/sysctl.sh +1
-0@@ -120,6 +120,7 @@ test_reqs() function load_req_mod() { + trap "test_modprobe" EXIT if [ ! -d $DIR ]; then if ! modprobe -q -n $TEST_DRIVER; then echo "$0: module $TEST_DRIVER not found [SKIP]"
tools/testing/selftests/sysctl/sysctl.sh function parse_args() · line 773
Quoted 4 lines
tools/testing/selftests/sysctl/sysctl.sh +0
-1@@ -770,7 +771,6 @@ function parse_args() test_reqs allow_user_defaults check_production_sysctl_writes_strict -test_modprobe
Better yet, we can just depend on /proc/config stuff for test modules, refer to check_mods() on tools/testing/selftests/firmware/fw_lib.sh. Feel free to make helpers if you can come up with a generic directory, otherwise just duplicate the effort for now.
Luis