blob: 0d17f668e2a651dcd3187380b66622e0927c6c7e [file] [log] [blame]
Release Notes
This page briefly summarizes the KUnit changes in each Linux release.
For more specific documentation on KUnit features, see the in-kernel
- KUnit introduced, including all the basic functionality.
- ``kunitconfig`` was renamed to ``.kunitconfig`` later in in 5.5 (`commit
- KUnit tests can be built as modules, `docs
- switched to using ``.kunit/`` as the default build dir (and
``.kunitconfig`` => ``.kunit/.kunitconfig``).
- ``CONFIG_KUNIT_DEBUGFS`` to expose per-suite test results in
``/sys/kernel/debug/kunit/<suite>/results``, `docs
- ```` now supports separate ``config/build/exec/parse`` commands in
addition to ``run``.
- You can use these if you don't want to let `` run`` do everything
for you, e.g. if you want to run manually but parse the results using
- ``CONFIG_KUNIT_ALL_TESTS`` introduced
- This is just a convention. New tests should use it like so:
.. code-block:: none
tristate "KUnit test for foo" if !KUNIT_ALL_TESTS
depends on KUNIT
This builds unit tests for foo.
See `the upstream documentation
for the authoritative source on how to write Kconfig entries.
- Named resources: tests can store and retrieve data via string keys.
- This is a power feature intended to be a cleaner alternative to using
global variables in tests.
- See `test_kasan.c
<>`__ for an
example that uses ``"kasan_data"``.
- KASAN violations cause the current KUnit test case to be marked FAILED.
- Note: KASAN doesn't currently work on UML.
- Parameterized testing: see the `docs
- You can pass in a path to a kunitconfig file instead of using
``.kunit/.kunitconfig``, e.g.
.. code-block:: shell
$ ./tools/testing/kunit/ run --kunitconfig=fs/ext4/.kunitconfig
- You can tell ```` to run a subset of built suites by passing in a
glob argument, e.g.
.. code-block:: shell
# Only run "list" suites
$ ./tools/testing/kunit/ run '*list*'
- Can call ``kunit_fail_current_test()`` from anywhere to fail the current KUnit test (e.g. if an invariant is broken, a UBSAN violation is detected, etc.)
- You can pass a directory ``--kunitconfig`` and it'll implicitly append
``.kunitconfig``, e.g. `` run --kunitconfig=lib/kunit``.
- ```` can run tests on non-UML architectures (using QEMU), `docs
- It's now possible to generate code coverage reports when using UML, `docs
- Tests can call ``kunit_skip()`` to bail out and mark a test as "SKIPPED"
instead of "PASSED" or "FAILED"
- UBSAN violations cause the current KUnit test case to be marked FAILED.
- Can pass kernel commandline parameters from ```` via
- KUnit prints a summary per suite of how many test cases passed/failed to
dmesg, e.g.
.. code-block:: shell
# property-entry: pass:7 fail:0 skip:0 total:7
5.16 (tentative)
- You can filter on test names now in addition to suite names, e.g.
.. code-block:: shell
# Only run tests that contain "foo"
$ ./tools/testing/kunit/ run '*.*foo*'
# Only run tests in "mysuite" that contain "foo"
$ ./tools/testing/kunit/ run 'mysuite.*foo*'
- You can ask ```` to run each suite/test by itself. This can be useful
to track down issues due to non-hermetic tests
.. code-block:: shell
$ ./tools/testing/kunit/ run --run_isolated=suite
$ ./tools/testing/kunit/ run --run_isolated=test
- ````'s parsing logic was largely rewritten, so the output looks
slightly different
- Parsed output is also now mostly printed out in real time.
- ```` with ``--raw_output`` will print output in real time.
5.17 (tentative)
- Print out parsed test results in real time.
- Allow tweaking Kconfig options from command-line, e.g.
.. code-block:: shell
$ ./tools/testing/kunit/ run --kconfig_add=MY_CONFIG=y
- Reconfigure kunit kernel when the used ``kunitconfig`` has changed
- Before, if you removed an entry from ``.kunitconfig``, ```` would
not reconfigure, so your edit would have no effect.
- This now also works if you remove a ``--kconfig_add`` flag.
- Print out parameters as sub-test cases (both in raw and parsed output), e.g.:
.. code-block::
[12:37:14] =============== ext4_inode_test (1 subtest) ================
[12:37:14] ======= inode_test_xtimestamp_decoding (16 subtests) =======
[12:37:14] [PASSED] 1901-12-13 Lower bound of 32bit < 0 timestamp, no extra bits
[12:37:14] [PASSED] 2446-05-10 Upper bound of 32bit >=0 timestamp. All extra sec bits on
[12:37:14] ========= [PASSED] inode_test_xtimestamp_decoding ==========
[12:37:14] ================= [PASSED] ext4_inode_test =================
[12:37:14] ============================================================