blob: 7bc187aa76f3107ed499dea1111d2d11c4237061 [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
documentation: https://kernel.org/doc/html/latest/dev-tools/kunit.
.. _v5.5:
5.5
===
- KUnit introduced, including all the basic functionality.
- ``kunitconfig`` was renamed to ``.kunitconfig`` later in in 5.5 (`commit
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=14ee5cfd4512ee3d1e0047d8751450dcc6544070>`__)
.. _v5.6:
5.6
===
- KUnit tests can be built as modules, `docs
<https://www.kernel.org/doc/html/latest/dev-tools/kunit/running_tips.html#running-tests-as-modules>`__
.. _v5.7:
5.7
===
- kunit.py 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
<https://www.kernel.org/doc/html/latest/dev-tools/kunit/running_tips.html#retrieving-per-suite-results>`__
.. _v5.8:
5.8
===
- ``kunit.py`` now supports separate ``config/build/exec/parse`` commands in
addition to ``run``.
- You can use these if you don't want to let ``kunit.py run`` do everything
for you, e.g. if you want to run manually but parse the results using
``kunit.py``.
- ``CONFIG_KUNIT_ALL_TESTS`` introduced
- This is just a convention. New tests should use it like so:
.. code-block:: none
config FOO_KUNIT_TEST
tristate "KUnit test for foo" if !KUNIT_ALL_TESTS
depends on KUNIT
default KUNIT_ALL_TESTS
help
This builds unit tests for foo.
See `the upstream documentation
<https://www.kernel.org/doc/html/latest/dev-tools/kunit/style.html#test-kconfig-entries>`__
for the authoritative source on how to write Kconfig entries.
.. _v5.9:
5.9
===
- 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
<https://elixir.bootlin.com/linux/latest/source/lib/test_kasan.c>`__ for an
example that uses ``"kasan_data"``.
.. _v5.10:
5.10
====
- KASAN violations cause the current KUnit test case to be marked FAILED.
- Note: KASAN doesn't currently work on UML.
.. _v5.11:
5.11
====
- Parameterized testing: see the `docs
<https://www.kernel.org/doc/html/latest/dev-tools/kunit/usage.html#parameterized-testing>`__.
.. _v5.12:
5.12
====
- You can pass in a path to a kunitconfig file instead of using
``.kunit/.kunitconfig``, e.g.
.. code-block:: shell
$ ./tools/testing/kunit/kunit.py run --kunitconfig=fs/ext4/.kunitconfig
- You can tell ``kunit.py`` 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/kunit.py run '*list*'
.. _v5.13:
5.13
====
- 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. ``kunit.py run --kunitconfig=lib/kunit``.
.. _v5.14:
5.14
====
- ``kunit.py`` can run tests on non-UML architectures (using QEMU), `docs
<https://www.kernel.org/doc/html/latest/dev-tools/kunit/kunit-tool.html#running-tests-on-qemu>`__
- It's now possible to generate code coverage reports when using UML, `docs
<https://www.kernel.org/doc/html/latest/dev-tools/kunit/running_tips.html#generating-code-coverage-reports-under-uml>`__
- Tests can call ``kunit_skip()`` to bail out and mark a test as "SKIPPED"
instead of "PASSED" or "FAILED"
.. _v5.15:
5.15
====
- UBSAN violations cause the current KUnit test case to be marked FAILED.
- Can pass kernel commandline parameters from ``kunit.py`` via
``--kernel_args``
- 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
.. _v5.16:
5.16
====
- 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/kunit.py run '*.*foo*'
# Only run tests in "mysuite" that contain "foo"
$ ./tools/testing/kunit/kunit.py run 'mysuite.*foo*'
- You can ask ``kunit.py`` 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/kunit.py run --run_isolated=suite
$ ./tools/testing/kunit/kunit.py run --run_isolated=test
- ``kunit.py``'s parsing logic was largely rewritten, so the output looks
slightly different
- Parsed output is also now mostly printed out in real time.
- ``kunit.py`` with ``--raw_output`` will print output in real time.
- In-kernel documentation has been significantly revamped.
.. _v5.17:
5.17
====
- Print out parsed test results in real time.
- Allow tweaking Kconfig options from command-line, e.g.
.. code-block:: shell
$ ./tools/testing/kunit/kunit.py run --kconfig_add=MY_CONFIG=y
- Reconfigure kunit kernel when the used ``kunitconfig`` has changed
- Before, if you removed an entry from ``.kunitconfig``, ``kunit.py`` 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] ============================================================
.. _v5.18:
5.18
====
- Drastically decrease stack usage of ``KUNIT_EXPECT_`` macros.
- Before, we largely relied on the compiler to optimize away some internal
structs, but that didn't always work.
- Now on UML (x86_64), ``KUNIT_EXPECT_EQ()`` uses 32 bytes instead of 88.
.. _v5.19:
5.19
====
- Add support for suite-level init/exit functions.
- ``suite_init``/``suite_exit`` are like ``init`` and ``exit`` instead of once per test case.
- Add ``KUNIT_EXPECT_NULL()``/``KUNIT_EXPECT_NOT_NULL()`` macros.
- Split out KUnit resource API from ``<kunit/test.h>`` into ``<kunit/resource.h>``.
- Including ``<kunit/test.h>`` will still automatically ``#include <kunit/resource.h>`` for now.
- ``kunit.py`` no longer colorizes output when stdout is not a tty.
- Add a manually curated ``tools/testing/kunit/configs/all_tests_uml.config``
- This attempts to enable as many tests as possible on UML.
- Change quoting requirements for qemu_config files (`commit
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3f0a50f345f78183f6e9b39c2f45ca5dcaa511ca>`__)
- E.g. instead of ``['-m 256']``, do ``['-m', '256']``
.. _v6.0:
6.0 (tentative)
===============
- Overhaul support for building tests as modules
- Before, it wouldn't work in modules that already had their own
``module_init``/``module_exit``. Now this restriction is gone.
- Add ``--qemu_args`` flag, e.g. use ``--qemu_args='-m 2048'`` to give tests more RAM.
- Allow ``--kunitconfig`` to be repeated.
- This will just concatenante the contents together.
- One use case for this is appending the options for code coverage:
.. code-block:: shell
$ ./tools/testing/kunit/kunit.py run --kunitconfig=my/dir --kunitconfig=tools/testing/kunit/configs/coverage_uml.config
- Taint the kernel if any KUnit tests run.
- Add a new ``TAINT_TEST`` flag, shows up as ``'N'``.
- Add support for KASAN to run on 64-bit UML.
- By default, enable PCI support under UML.