linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shuah Khan <shuah@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"Luis R . Rodriguez" <mcgrof@kernel.org>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Kees Cook <keescook@chromium.org>,
	Masami Hiramatsu <masami.hiramatsu@linaro.org>
Subject: [PATCH 3/4] selftests/sysctl: Fix to load test_sysctl module
Date: Thu, 28 May 2020 23:52:26 +0900	[thread overview]
Message-ID: <159067754657.229397.15961438722058766667.stgit@devnote2> (raw)
In-Reply-To: <159067751438.229397.6746886115540895104.stgit@devnote2>

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 <mhiramat@kernel.org>
---
 tools/testing/selftests/sysctl/sysctl.sh |   13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/tools/testing/selftests/sysctl/sysctl.sh b/tools/testing/selftests/sysctl/sysctl.sh
index 6a970b127c9b..c3459f9f2429 100755
--- a/tools/testing/selftests/sysctl/sysctl.sh
+++ b/tools/testing/selftests/sysctl/sysctl.sh
@@ -40,16 +40,6 @@ ALL_TESTS="$ALL_TESTS 0004:1:1:uint_0001"
 ALL_TESTS="$ALL_TESTS 0005:3:1:int_0003"
 ALL_TESTS="$ALL_TESTS 0006:50:1:bitmap_0001"
 
-test_modprobe()
-{
-       if [ ! -d $DIR ]; then
-               echo "$0: $DIR not present" >&2
-               echo "You must have the following enabled in your kernel:" >&2
-               cat $TEST_DIR/config >&2
-               exit $ksft_skip
-       fi
-}
-
 function allow_user_defaults()
 {
 	if [ -z $DIR ]; then
@@ -125,10 +115,12 @@ function load_req_mod()
 	if [ ! -d $DIR ]; then
 		if ! modprobe -q -n $TEST_DRIVER; then
 			echo "$0: module $TEST_DRIVER not found [SKIP]"
+			echo "You must set CONFIG_TEST_SYSCTL=m in your kernel" >&2
 			exit $ksft_skip
 		fi
 		modprobe $TEST_DRIVER
 		if [ $? -ne 0 ]; then
+			echo "$0: modprobe $TEST_DRIVER failed."
 			exit
 		fi
 	fi
@@ -929,7 +921,6 @@ test_reqs
 allow_user_defaults
 check_production_sysctl_writes_strict
 load_req_mod
-test_modprobe
 
 trap "test_finish" EXIT
 


  parent reply	other threads:[~2020-05-28 14:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 14:51 [PATCH 0/4] selftests, sysctl, lib: Fix prime_numbers and sysctl test to run Masami Hiramatsu
2020-05-28 14:52 ` [PATCH 1/4] lib: Make prime number generator independently selectable Masami Hiramatsu
2020-05-29  5:56   ` Kees Cook
2020-05-29 13:55     ` Masami Hiramatsu
2020-06-01 13:15   ` Luis Chamberlain
2020-05-28 14:52 ` [PATCH 2/4] lib: Make test_sysctl initialized as module Masami Hiramatsu
2020-05-29  5:52   ` Kees Cook
2020-06-01 13:14   ` Luis Chamberlain
2020-05-28 14:52 ` Masami Hiramatsu [this message]
2020-05-29  5:57   ` [PATCH 3/4] selftests/sysctl: Fix to load test_sysctl module Kees Cook
2020-06-01 13:15   ` Luis Chamberlain
2020-05-28 14:52 ` [PATCH 4/4] selftests/sysctl: Make sysctl test driver as a module Masami Hiramatsu
2020-05-29  5:57   ` Kees Cook
2020-06-01 13:15   ` Luis Chamberlain
2020-05-29 14:14 ` [PATCH 0/4] selftests, sysctl, lib: Fix prime_numbers and sysctl test to run Shuah Khan
2020-05-29 14:39   ` Masami Hiramatsu
2020-06-02 16:32     ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=159067754657.229397.15961438722058766667.stgit@devnote2 \
    --to=mhiramat@kernel.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=masami.hiramatsu@linaro.org \
    --cc=mcgrof@kernel.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).