Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Joe Fradley <joefradley@google.com>
To: Jonathan Corbet <corbet@lwn.net>,
	Brendan Higgins <brendan.higgins@linux.dev>,
	David Gow <davidgow@google.com>
Cc: Joe Fradley <joefradley@google.com>,
	kernel-team@android.com, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	kunit-dev@googlegroups.com
Subject: [PATCH v2 0/2] kunit: add boot time parameter to enable KUnit
Date: Tue, 23 Aug 2022 07:24:53 -0700	[thread overview]
Message-ID: <20220823142456.3977086-1-joefradley@google.com> (raw)

v2:
 - Added enable check in executor.c to prevent wrong error output from
   kunit_tool.py when run against a KUnit disabled kernel
 - kunit_tool.py now passes kunit.enable=1
 - Flipped around logic of new config to KUNIT_DEFAULT_ENABLED
 - Now load modules containing tests but not executing them
 - Various message/description text clean up

There are some use cases where the kernel binary is desired to be the same
for both production and testing. This poses a problem for users of KUnit
as built-in tests will automatically run at startup and test modules
can still be loaded leaving the kernel in an unsafe state. There is a
"test" taint flag that gets set if a test runs but nothing to prevent
the execution.

This patch adds the kunit.enable module parameter that will need to be
set to true in addition to KUNIT being enabled for KUnit tests to run.
The default value is true giving backwards compatibility. However, for
the production+testing use case the new config option KUNIT_DEFAULT_ENABLED
can be set to N requiring the tester to opt-in by passing kunit.enable=1 to
the kernel.

Joe Fradley (2):
  kunit: add kunit.enable to enable/disable KUnit test
  kunit: no longer call module_info(test, "Y") for kunit modules

 .../admin-guide/kernel-parameters.txt         |  6 +++++
 include/kunit/test.h                          |  3 ++-
 lib/kunit/Kconfig                             | 11 +++++++++
 lib/kunit/executor.c                          |  4 ++++
 lib/kunit/test.c                              | 24 +++++++++++++++++++
 tools/testing/kunit/kunit_kernel.py           |  1 +
 6 files changed, 48 insertions(+), 1 deletion(-)

-- 
2.37.1.595.g718a3a8f04-goog


             reply	other threads:[~2022-08-23 16:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 14:24 Joe Fradley [this message]
2022-08-23 14:24 ` [PATCH v2 1/2] kunit: add kunit.enable to enable/disable KUnit test Joe Fradley
2022-08-24  4:31   ` David Gow
2022-08-24  5:04     ` Joe Fradley
2022-08-24  6:33       ` David Gow
2022-08-24 14:13         ` Joe Fradley
2022-08-23 14:24 ` [PATCH v2 2/2] kunit: no longer call module_info(test, "Y") for kunit modules Joe Fradley
2022-09-25  0:42 ` [PATCH v2 0/2] kunit: add boot time parameter to enable KUnit Tales Aparecida
2022-09-28 13:58   ` Joe Fradley
2022-09-28 17:26     ` Tales Aparecida
2022-09-28 21:35       ` Joe Fradley

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=20220823142456.3977086-1-joefradley@google.com \
    --to=joefradley@google.com \
    --cc=brendan.higgins@linux.dev \
    --cc=corbet@lwn.net \
    --cc=davidgow@google.com \
    --cc=kernel-team@android.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.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