Skip to content

Commit eee470e

Browse files
mhiramatshuahkh
authored andcommitted
selftests/sysctl: Fix to load test_sysctl module
Fix to load test_sysctl.ko module correctly. sysctl.sh checks whether the test module is embedded (or loaded already) or not at first, and if not, it returns skip error instead of trying modprobe. Thus, there is no chance to load the test_sysctl test module. Instead, this removes that module embedded check and returns skip error only if it ensures that there is no embedded test module *and* no loadable test module. This also avoid referring config file since that is not installed. Signed-off-by: Masami Hiramatsu <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: Luis Chamberlain <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 2f56f84 commit eee470e

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

tools/testing/selftests/sysctl/sysctl.sh

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001"
4040
ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003"
4141
ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001"
4242

43-
test_modprobe()
44-
{
45-
if [ ! -d $DIR ]; then
46-
echo "$0: $DIR not present" >&2
47-
echo "You must have the following enabled in your kernel:" >&2
48-
cat $TEST_DIR/config >&2
49-
exit $ksft_skip
50-
fi
51-
}
52-
5343
function allow_user_defaults()
5444
{
5545
if [ -z $DIR ]; then
@@ -125,10 +115,12 @@ function load_req_mod()
125115
if [ ! -d $DIR ]; then
126116
if ! modprobe -q -n $TEST_DRIVER; then
127117
echo "$0: module $TEST_DRIVER not found [SKIP]"
118+
echo "You must set CONFIG_TEST_SYSCTL=m in your kernel" >&2
128119
exit $ksft_skip
129120
fi
130121
modprobe $TEST_DRIVER
131122
if [ $? -ne 0 ]; then
123+
echo "$0: modprobe $TEST_DRIVER failed."
132124
exit
133125
fi
134126
fi
@@ -929,7 +921,6 @@ test_reqs
929921
allow_user_defaults
930922
check_production_sysctl_writes_strict
931923
load_req_mod
932-
test_modprobe
933924

934925
trap "test_finish" EXIT
935926

0 commit comments

Comments
 (0)