Commit 595a56ac authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'linux-kselftest-kunit-5.8-rc1' of...

Merge tag 'linux-kselftest-kunit-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest

Pull Kunit updates from Shuah Khan:
 "This consists of:

   - Several config fragment fixes from Anders Roxell to improve test
     coverage.

   - Improvements to kunit run script to use defconfig as default and
     restructure the code for config/build/exec/parse from Vitor Massaru
     Iha and David Gow.

   - Miscellaneous documentation warn fix"

* tag 'linux-kselftest-kunit-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  security: apparmor: default KUNIT_* fragments to KUNIT_ALL_TESTS
  fs: ext4: default KUNIT_* fragments to KUNIT_ALL_TESTS
  drivers: base: default KUNIT_* fragments to KUNIT_ALL_TESTS
  lib: Kconfig.debug: default KUNIT_* fragments to KUNIT_ALL_TESTS
  kunit: default KUNIT_* fragments to KUNIT_ALL_TESTS
  kunit: Kconfig: enable a KUNIT_ALL_TESTS fragment
  kunit: Fix TabError, remove defconfig code and handle when there is no kunitconfig
  kunit: use KUnit defconfig by default
  kunit: use --build_dir=.kunit as default
  Documentation: test.h - fix warnings
  kunit: kunit_tool: Separate out config/build/exec/parse
parents fc2fb38c 6d6861d4
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -32,12 +32,14 @@ test targets as well. The ``.kunitconfig`` should also contain any other config
options required by the tests.

A good starting point for a ``.kunitconfig`` is the KUnit defconfig:

.. code-block:: bash

	cd $PATH_TO_LINUX_REPO
	cp arch/um/configs/kunit_defconfig .kunitconfig

You can then add any other Kconfig options you wish, e.g.:

.. code-block:: none

	CONFIG_LIST_KUNIT_TEST=y
@@ -54,8 +56,8 @@ using.
   other tools (such as make menuconfig) to adjust other config options.


Running the tests
-----------------
Running the tests (KUnit Wrapper)
---------------------------------

To make sure that everything is set up correctly, simply invoke the Python
wrapper from your kernel repo:
@@ -105,8 +107,9 @@ have config options ending in ``_KUNIT_TEST``.
KUnit and KUnit tests can be compiled as modules: in this case the tests in a
module will be run when the module is loaded.

Running the tests
-----------------

Running the tests (w/o KUnit Wrapper)
-------------------------------------

Build and run your kernel as usual. Test output will be written to the kernel
log in `TAP <https://testanything.org/>`_ format.
+2 −2
Original line number Diff line number Diff line
@@ -595,7 +595,7 @@ able to run one test case per invocation.
KUnit debugfs representation
============================
When kunit test suites are initialized, they create an associated directory
in /sys/kernel/debug/kunit/<test-suite>.  The directory contains one file
in ``/sys/kernel/debug/kunit/<test-suite>``.  The directory contains one file

- results: "cat results" displays results of each test case and the results
  of the entire suite for the last test run.
@@ -604,4 +604,4 @@ The debugfs representation is primarily of use when kunit test suites are
run in a native environment, either as modules or builtin.  Having a way
to display results like this is valuable as otherwise results can be
intermixed with other events in dmesg output.  The maximum size of each
results file is KUNIT_LOG_SIZE bytes (defined in include/kunit/test.h).
results file is KUNIT_LOG_SIZE bytes (defined in ``include/kunit/test.h``).
+2 −1
Original line number Diff line number Diff line
@@ -149,8 +149,9 @@ config DEBUG_TEST_DRIVER_REMOVE
	  test this functionality.

config PM_QOS_KUNIT_TEST
	bool "KUnit Test for PM QoS features"
	bool "KUnit Test for PM QoS features" if !KUNIT_ALL_TESTS
	depends on KUNIT=y
	default KUNIT_ALL_TESTS

config HMEM_REPORTING
	bool
+2 −1
Original line number Diff line number Diff line
@@ -9,5 +9,6 @@ config TEST_ASYNC_DRIVER_PROBE

	  If unsure say N.
config KUNIT_DRIVER_PE_TEST
	bool "KUnit Tests for property entry API"
	bool "KUnit Tests for property entry API" if !KUNIT_ALL_TESTS
	depends on KUNIT=y
	default KUNIT_ALL_TESTS
+2 −1
Original line number Diff line number Diff line
@@ -102,9 +102,10 @@ config EXT4_DEBUG
	  using dynamic debug control for mb_debug() / ext_debug() msgs.

config EXT4_KUNIT_TESTS
	tristate "KUnit tests for ext4"
	tristate "KUnit tests for ext4" if !KUNIT_ALL_TESTS
	select EXT4_FS
	depends on KUNIT
	default KUNIT_ALL_TESTS
	help
	  This builds the ext4 KUnit tests.

Loading