Commit 08a3ef8f authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

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

Pull Kselftest kunit updates from Shuah Khan:
 "This kunit update consists of:

   - Support for building kunit as a module from Alan Maguire

   - AppArmor KUnit tests for policy unpack from Mike Salvatore"

* tag 'linux-kselftest-5.6-rc1-kunit' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
  kunit: building kunit as a module breaks allmodconfig
  kunit: update documentation to describe module-based build
  kunit: allow kunit to be loaded as a module
  kunit: remove timeout dependence on sysctl_hung_task_timeout_seconds
  kunit: allow kunit tests to be loaded as a module
  kunit: hide unexported try-catch interface in try-catch-impl.h
  kunit: move string-stream.h to lib/kunit
  apparmor: add AppArmor KUnit tests for policy unpack
parents ce7ae9d9 35c57fc3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ Yes, well, mostly.

For the most part, the KUnit core framework (what you use to write the tests)
can compile to any architecture; it compiles like just another part of the
kernel and runs when the kernel boots. However, there is some infrastructure,
kernel and runs when the kernel boots, or when built as a module, when the
module is loaded.  However, there is some infrastructure,
like the KUnit Wrapper (``tools/testing/kunit/kunit.py``) that does not support
other architectures.

+3 −0
Original line number Diff line number Diff line
@@ -49,6 +49,9 @@ to a standalone program that can be run like any other program directly inside
of a host operating system; to be clear, it does not require any virtualization
support; it is just a regular program.

Alternatively, kunit and kunit tests can be built as modules and tests will
run when the test module is loaded.

KUnit is fast. Excluding build time, from invocation to completion KUnit can run
several dozen tests in only 10 to 20 seconds; this might not sound like a big
deal to some people, but having such fast and easy to run tests fundamentally
+16 −0
Original line number Diff line number Diff line
@@ -539,6 +539,22 @@ Interspersed in the kernel logs you might see the following:

Congratulations, you just ran a KUnit test on the x86 architecture!

In a similar manner, kunit and kunit tests can also be built as modules,
so if you wanted to run tests in this way you might add the following config
options to your ``.config``:

.. code-block:: none

	CONFIG_KUNIT=m
	CONFIG_KUNIT_EXAMPLE_TEST=m

Once the kernel is built and installed, a simple

.. code-block:: bash
	modprobe example-test

...will run the tests.

Writing new tests for other architectures
-----------------------------------------

+1 −1
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ config DEBUG_TEST_DRIVER_REMOVE

config PM_QOS_KUNIT_TEST
	bool "KUnit Test for PM QoS features"
	depends on KUNIT
	depends on KUNIT=y

config HMEM_REPORTING
	bool
+1 −1
Original line number Diff line number Diff line
@@ -114,4 +114,4 @@ static struct kunit_suite pm_qos_test_module = {
	.name = "qos-kunit-test",
	.test_cases = pm_qos_test_cases,
};
kunit_test_suite(pm_qos_test_module);
kunit_test_suites(&pm_qos_test_module);
Loading