Skip to content

kunit: add boot time parameter to enable KUnit

Joe Fradley linux-doc linux-kselftest lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 8 repliesIn review
  2. v12 patches 5 repliesSuperseded

Changes in v2 from the cover letter

- 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

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kunit: add kunit.enable to enable/disable KUnit testDocumentation/admin-guide/kernel-parameters.txt include/kunit/test.h lib/kunit/Kconfig +3 more+48 -04 replies
2/2kunit: no longer call module_info(test, "Y") for kunit modulesinclude/kunit/test.h+0 -10 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchDavid GowBrendan HigginsTales Aparecida
SeriesT-b
1/2R-b
2/2R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [PATCH v2 0/2] kunit: add boot time parameter to enable KUnit

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(-)
Signature · 1 line
2.37.1.595.g718a3a8f04-goog