Lines Matching +full:run +full:- +full:time

1 .. SPDX-License-Identifier: GPL-2.0
8 teaching how to run existing tests and then how to write a simple test case,
9 and covers common problems users face when using KUnit for the first time.
14 build the kernel, you can run KUnit.
20 can run kunit_tool:
22 .. code-block:: bash
24 ./tools/testing/kunit/kunit.py run
28 "The source tree is not clean, please run 'make ARCH=um mrproper'"
32 through the argument ``--build_dir``. Hence, before starting an
33 out-of-tree build, the source tree must be clean.
36 the kernel" section of the :doc:`admin-guide </admin-guide/README>`,
44 .. code-block::
53 Because it is building a lot of sources for the first time,
57 Documentation/dev-tools/kunit/run_wrapper.rst.
59 Selecting which tests to run
60 ----------------------------
64 you can select which tests to run by:
66 - `Customizing Kconfig`_ used to compile the kernel, or
67 - `Filtering tests by name`_ to select specifically which compiled tests to run.
72 If you didn't run ``kunit.py run`` yet, you can generate it by running:
74 .. code-block:: bash
81 ``.kunitconfig`` lives in the ``--build_dir`` used by kunit.py, which is
91 options required to run the desired tests, including their dependencies.
94 If you need to run on an architecture other than UML see :ref:`kunit-on-qemu`.
97 For example, to include the kernel's linked-list test you can run::
99 ./tools/testing/kunit/kunit.py run \
100 --kconfig_add CONFIG_LIST_KUNIT_TEST=y
103 For example, to run only ``FAT_FS`` and ``EXT4`` tests you can run::
105 ./tools/testing/kunit/kunit.py run \
106 --kunitconfig ./fs/fat/.kunitconfig \
107 --kunitconfig ./fs/ext4/.kunitconfig
125 to select which tests to execute at boot-time by passing a glob filter
133 to run every test case it contains::
135 ./tools/testing/kunit/kunit.py run "kunit_executor_test"
138 like ``"example.example_simple_test"``, to run specifically that test case::
140 ./tools/testing/kunit/kunit.py run "example.example_simple_test"
142 c. use wildcard characters (``*?[``) to run any test case that matches the pattern,
143 like ``"*.*64*"`` to run test cases containing ``"64"`` in the name inside
146 ./tools/testing/kunit/kunit.py run "*.*64*"
157 Enabling KUnit disables Kernel Address-Space Layout Randomization
162 ----------------------
169 will run when the module is loaded.
172 -------------------------------------
173 Build and run your kernel. In the kernel log, the test output is printed
175 are built-in. Otherwise the module will need to be loaded.
186 .. code-block:: c
192 .. code-block:: c
205 .. code-block:: kconfig
212 .. code-block:: make
214 obj-$(CONFIG_MISC_EXAMPLE) += example.o
220 .. code-block:: c
231 KUNIT_EXPECT_EQ(test, 0, misc_example_add(-1, 1));
233 KUNIT_EXPECT_EQ(test, -1, misc_example_add(INT_MAX, INT_MIN));
248 .name = "misc-example",
257 .. code-block:: kconfig
269 .. code-block:: make
271 obj-$(CONFIG_MISC_EXAMPLE_TEST) += example_test.o
275 .. code-block:: none
280 5. Run the test:
282 .. code-block:: bash
284 ./tools/testing/kunit/kunit.py run
288 .. code-block:: none
291 [16:08:57] [PASSED] misc-example:misc_example_add_test_basic
292 [16:08:57] [FAILED] misc-example:misc_example_test_failure
293 [16:08:57] EXPECTATION FAILED at drivers/misc/example-test.c:17
303 take a look at Documentation/dev-tools/kunit/run_wrapper.rst
305 If you'd like to run tests without using kunit.py, check out
306 Documentation/dev-tools/kunit/run_manual.rst
309 for testing different things), see Documentation/dev-tools/kunit/usage.rst