€•w©Œsphinx.addnodes”Œdocument”“”)�”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)�”}”(hhh]”(hŒ pending_xref”“”)�”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…”�”}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ0/translations/zh_CN/dev-tools/kunit/architecture”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/zh_TW/dev-tools/kunit/architecture”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/it_IT/dev-tools/kunit/architecture”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/ja_JP/dev-tools/kunit/architecture”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/ko_KR/dev-tools/kunit/architecture”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/pt_BR/dev-tools/kunit/architecture”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/sp_SP/dev-tools/kunit/architecture”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)�”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…”�”}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒJ/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/architecture.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒKUnit Architecture”h]”hŒKUnit Architecture”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)�”}”(hŒ1The KUnit architecture is divided into two parts:”h]”hŒ1The KUnit architecture is divided into two parts:”…”�”}”(hhßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒ`In-Kernel Testing Framework`_”h]”hÞ)�”}”(hhöh]”hŒ reference”“”)�”}”(hhöh]”hŒIn-Kernel Testing Framework”…”�”}”(hhýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”ŒIn-Kernel Testing Framework”Œrefid”Œin-kernel-testing-framework”uh1hûhhøŒresolved”Kubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hhôubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhhïh²hh³hÇh´Nubhó)�”}”(hŒ*`kunit_tool (Command-line Test Harness)`_ ”h]”hÞ)�”}”(hŒ)`kunit_tool (Command-line Test Harness)`_”h]”hü)�”}”(hj!h]”hŒ&kunit_tool (Command-line Test Harness)”…”�”}”(hj#h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ&kunit_tool (Command-line Test Harness)”j Œ$kunit-tool-command-line-test-harness”uh1hûhjjKubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhhïh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1híh³hÇh´K hhÊh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒIn-Kernel Testing Framework”h]”hŒIn-Kernel Testing Framework”…”�”}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjGh²hh³hÇh´K ubhÞ)�”}”(hŒ�The kernel testing library supports KUnit tests written in C using KUnit. These KUnit tests are kernel code. KUnit performs the following tasks:”h]”hŒ�The kernel testing library supports KUnit tests written in C using KUnit. These KUnit tests are kernel code. KUnit performs the following tasks:”…”�”}”(hjXh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhjGh²hubhî)�”}”(hhh]”(hó)�”}”(hŒOrganizes tests”h]”hÞ)�”}”(hjkh]”hŒOrganizes tests”…”�”}”(hjmh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjiubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjfh²hh³hÇh´Nubhó)�”}”(hŒReports test results”h]”hÞ)�”}”(hj‚h]”hŒReports test results”…”�”}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khj€ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjfh²hh³hÇh´Nubhó)�”}”(hŒProvides test utilities ”h]”hÞ)�”}”(hŒProvides test utilities”h]”hŒProvides test utilities”…”�”}”(hj›h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khj—ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjfh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jEjFuh1híh³hÇh´KhjGh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Test Cases”h]”hŒ Test Cases”…”�”}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjµh²hh³hÇh´KubhÞ)�”}”(hŒýThe test case is the fundamental unit in KUnit. KUnit test cases are organised into suites. A KUnit test case is a function with type signature ``void (*)(struct kunit *test)``. These test case functions are wrapped in a struct called struct kunit_case.”h]”(hŒ�The test case is the fundamental unit in KUnit. KUnit test cases are organised into suites. A KUnit test case is a function with type signature ”…”�”}”(hjÆh²hh³Nh´NubhŒliteral”“”)�”}”(hŒ ``void (*)(struct kunit *test)``”h]”hŒvoid (*)(struct kunit *test)”…”�”}”(hjÐh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjÆubhŒM. These test case functions are wrapped in a struct called struct kunit_case.”…”�”}”(hjÆh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjµh²hubh¶)�”}”(hŒBnote: ``generate_params`` is optional for non-parameterized tests.”h]”hŒBnote: ``generate_params`` is optional for non-parameterized tests.”…”�”}”hjèsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆuh1hµhjµh²hh³hÇh´K!ubhÞ)�”}”(hŒàEach KUnit test case receives a ``struct kunit`` context object that tracks a running test. The KUnit assertion macros and other KUnit utilities use the ``struct kunit`` context object. As an exception, there are two fields:”h]”(hŒ Each KUnit test case receives a ”…”�”}”(hjöh²hh³Nh´NubjÏ)�”}”(hŒ``struct kunit``”h]”hŒ struct kunit”…”�”}”(hjþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjöubhŒi context object that tracks a running test. The KUnit assertion macros and other KUnit utilities use the ”…”�”}”(hjöh²hh³Nh´NubjÏ)�”}”(hŒ``struct kunit``”h]”hŒ struct kunit”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjöubhŒ7 context object. As an exception, there are two fields:”…”�”}”(hjöh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K"hjµh²hubhî)�”}”(hhh]”(hó)�”}”(hŒN``->priv``: The setup functions can use it to store arbitrary test user data. ”h]”hÞ)�”}”(hŒM``->priv``: The setup functions can use it to store arbitrary test user data.”h]”(jÏ)�”}”(hŒ ``->priv``”h]”hŒ->priv”…”�”}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj/ubhŒC: The setup functions can use it to store arbitrary test user data.”…”�”}”(hj/h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K&hj+ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhj(h²hh³hÇh´Nubhó)�”}”(hŒf``->param_value``: It contains the parameter value which can be retrieved in the parameterized tests. ”h]”hÞ)�”}”(hŒe``->param_value``: It contains the parameter value which can be retrieved in the parameterized tests.”h]”(jÏ)�”}”(hŒ``->param_value``”h]”hŒ ->param_value”…”�”}”(hjYh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjUubhŒT: It contains the parameter value which can be retrieved in the parameterized tests.”…”�”}”(hjUh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K)hjQubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhj(h²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jEjFuh1híh³hÇh´K&hjµh²hubeh}”(h]”Œ test-cases”ah ]”h"]”Œ test cases”ah$]”h&]”uh1hÈhjGh²hh³hÇh´KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Test Suites”h]”hŒ Test Suites”…”�”}”(hjˆh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj…h²hh³hÇh´K-ubhÞ)�”}”(hŒA KUnit suite includes a collection of test cases. The KUnit suites are represented by the ``struct kunit_suite``. For example:”h]”(hŒ[A KUnit suite includes a collection of test cases. The KUnit suites are represented by the ”…”�”}”(hj–h²hh³Nh´NubjÏ)�”}”(hŒ``struct kunit_suite``”h]”hŒstruct kunit_suite”…”�”}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj–ubhŒ. For example:”…”�”}”(hj–h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K/hj…h²hubhŒ literal_block”“”)�”}”(hX—static struct kunit_case example_test_cases[] = { KUNIT_CASE(example_test_foo), KUNIT_CASE(example_test_bar), KUNIT_CASE(example_test_baz), {} }; static struct kunit_suite example_test_suite = { .name = "example", .init = example_test_init, .exit = example_test_exit, .test_cases = example_test_cases, }; kunit_test_suite(example_test_suite);”h]”hX—static struct kunit_case example_test_cases[] = { KUNIT_CASE(example_test_foo), KUNIT_CASE(example_test_bar), KUNIT_CASE(example_test_baz), {} }; static struct kunit_suite example_test_suite = { .name = "example", .init = example_test_init, .exit = example_test_exit, .test_cases = example_test_cases, }; kunit_test_suite(example_test_suite);”…”�”}”hj¸sbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”Œc”Œhighlight_args”}”uh1j¶h³hÇh´K2hj…h²hubhÞ)�”}”(hXuIn the above example, the test suite ``example_test_suite``, runs the test cases ``example_test_foo``, ``example_test_bar``, and ``example_test_baz``. Before running the test, the ``example_test_init`` is called and after running the test, ``example_test_exit`` is called. The ``kunit_test_suite(example_test_suite)`` registers the test suite with the KUnit test framework.”h]”(hŒ%In the above example, the test suite ”…”�”}”(hjËh²hh³Nh´NubjÏ)�”}”(hŒ``example_test_suite``”h]”hŒexample_test_suite”…”�”}”(hjÓh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjËubhŒ, runs the test cases ”…”�”}”(hjËh²hh³Nh´NubjÏ)�”}”(hŒ``example_test_foo``”h]”hŒexample_test_foo”…”�”}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjËubhŒ, ”…”�”}”(hjËh²hh³Nh´NubjÏ)�”}”(hŒ``example_test_bar``”h]”hŒexample_test_bar”…”�”}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjËubhŒ, and ”…”�”}”(hjËh²hh³Nh´NubjÏ)�”}”(hŒ``example_test_baz``”h]”hŒexample_test_baz”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjËubhŒ. Before running the test, the ”…”�”}”(hjËh²hh³Nh´NubjÏ)�”}”(hŒ``example_test_init``”h]”hŒexample_test_init”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjËubhŒ' is called and after running the test, ”…”�”}”(hjËh²hh³Nh´NubjÏ)�”}”(hŒ``example_test_exit``”h]”hŒexample_test_exit”…”�”}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjËubhŒ is called. The ”…”�”}”(hjËh²hh³Nh´NubjÏ)�”}”(hŒ(``kunit_test_suite(example_test_suite)``”h]”hŒ$kunit_test_suite(example_test_suite)”…”�”}”(hj?h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjËubhŒ8 registers the test suite with the KUnit test framework.”…”�”}”(hjËh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KChj…h²hubeh}”(h]”Œ test-suites”ah ]”h"]”Œ test suites”ah$]”h&]”uh1hÈhjGh²hh³hÇh´K-ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒExecutor”h]”hŒExecutor”…”�”}”(hjbh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj_h²hh³hÇh´KKubhÞ)�”}”(hXfThe KUnit executor can list and run built-in KUnit tests on boot. The Test suites are stored in a linker section called ``.kunit_test_suites``. For the code, see ``KUNIT_TABLE()`` macro definition in `include/asm-generic/vmlinux.lds.h `_. The linker section consists of an array of pointers to ``struct kunit_suite``, and is populated by the ``kunit_test_suites()`` macro. The KUnit executor iterates over the linker section array in order to run all the tests that are compiled into the kernel.”h]”(hŒxThe KUnit executor can list and run built-in KUnit tests on boot. The Test suites are stored in a linker section called ”…”�”}”(hjph²hh³Nh´NubjÏ)�”}”(hŒ``.kunit_test_suites``”h]”hŒ.kunit_test_suites”…”�”}”(hjxh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjpubhŒ. For the code, see ”…”�”}”(hjph²hh³Nh´NubjÏ)�”}”(hŒ``KUNIT_TABLE()``”h]”hŒ KUNIT_TABLE()”…”�”}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjpubhŒ macro definition in ”…”�”}”(hjph²hh³Nh´Nubhü)�”}”(hŒœ`include/asm-generic/vmlinux.lds.h `_”h]”hŒ!include/asm-generic/vmlinux.lds.h”…”�”}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œ!include/asm-generic/vmlinux.lds.h”Œrefuri”Œuhttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/asm-generic/vmlinux.lds.h?h=v6.0#n950”uh1hûhjpubhŒtarget”“”)�”}”(hŒx ”h]”h}”(h]”Œ!include-asm-generic-vmlinux-lds-h”ah ]”h"]”Œ!include/asm-generic/vmlinux.lds.h”ah$]”h&]”Œrefuri”j­uh1j®Œ referenced”KhjpubhŒ9. The linker section consists of an array of pointers to ”…”�”}”(hjph²hh³Nh´NubjÏ)�”}”(hŒ``struct kunit_suite``”h]”hŒstruct kunit_suite”…”�”}”(hjÂh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjpubhŒ, and is populated by the ”…”�”}”(hjph²hh³Nh´NubjÏ)�”}”(hŒ``kunit_test_suites()``”h]”hŒkunit_test_suites()”…”�”}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjpubhŒ‚ macro. The KUnit executor iterates over the linker section array in order to run all the tests that are compiled into the kernel.”…”�”}”(hjph²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KMhj_h²hubŒkfigure”Œ kernel_figure”“”)�”}”(hhh]”hŒfigure”“”)�”}”(hhh]”(hŒimage”“”)�”}”(hŒw.. kernel-figure:: kunit_suitememorydiagram.svg :alt: KUnit Suite Memory KUnit Suite Memory Diagram ”h]”h}”(h]”h ]”h"]”h$]”h&]”Œalt”ŒKUnit Suite Memory”Œuri”Œ,dev-tools/kunit/kunit_suitememorydiagram.svg”Œ candidates”}”Œ*”jsuh1j÷hjôh³hÇh´KubhŒcaption”“”)�”}”(hŒKUnit Suite Memory Diagram”h]”hŒKUnit Suite Memory Diagram”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´KZhjôubeh}”(h]”Œid1”ah ]”h"]”h$]”h&]”uh1jòhjïubah}”(h]”h ]”h"]”h$]”h&]”uh1jíhj_h²hh³hÇh´NubhÞ)�”}”(hXÒOn the kernel boot, the KUnit executor uses the start and end addresses of this section to iterate over and run all tests. For the implementation of the executor, see `lib/kunit/executor.c `_. When built as a module, the ``kunit_test_suites()`` macro defines a ``module_init()`` function, which runs all the tests in the compilation unit instead of utilizing the executor.”h]”(hŒ§On the kernel boot, the KUnit executor uses the start and end addresses of this section to iterate over and run all tests. For the implementation of the executor, see ”…”�”}”(hj'h²hh³Nh´Nubhü)�”}”(hŒv`lib/kunit/executor.c `_”h]”hŒlib/kunit/executor.c”…”�”}”(hj/h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œlib/kunit/executor.c”j¬Œ\https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/kunit/executor.c”uh1hûhj'ubj¯)�”}”(hŒ_ ”h]”h}”(h]”Œlib-kunit-executor-c”ah ]”h"]”Œlib/kunit/executor.c”ah$]”h&]”Œrefuri”j?uh1j®j½Khj'ubhŒ. When built as a module, the ”…”�”}”(hj'h²hh³Nh´NubjÏ)�”}”(hŒ``kunit_test_suites()``”h]”hŒkunit_test_suites()”…”�”}”(hjQh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj'ubhŒ macro defines a ”…”�”}”(hj'h²hh³Nh´NubjÏ)�”}”(hŒ``module_init()``”h]”hŒ module_init()”…”�”}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj'ubhŒ^ function, which runs all the tests in the compilation unit instead of utilizing the executor.”…”�”}”(hj'h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K\hj_h²hubhÞ)�”}”(hX?In KUnit tests, some error classes do not affect other tests or parts of the kernel, each KUnit case executes in a separate thread context. See the ``kunit_try_catch_run()`` function in `lib/kunit/try-catch.c `_.”h]”(hŒ”In KUnit tests, some error classes do not affect other tests or parts of the kernel, each KUnit case executes in a separate thread context. See the ”…”�”}”(hj{h²hh³Nh´NubjÏ)�”}”(hŒ``kunit_try_catch_run()``”h]”hŒkunit_try_catch_run()”…”�”}”(hjƒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj{ubhŒ function in ”…”�”}”(hj{h²hh³Nh´Nubhü)�”}”(hŒ„`lib/kunit/try-catch.c `_”h]”hŒlib/kunit/try-catch.c”…”�”}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”Œname”Œlib/kunit/try-catch.c”j¬Œihttps://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/lib/kunit/try-catch.c?h=v5.15#n58”uh1hûhj{ubj¯)�”}”(hŒl ”h]”h}”(h]”Œlib-kunit-try-catch-c”ah ]”h"]”Œlib/kunit/try-catch.c”ah$]”h&]”Œrefuri”j¥uh1j®j½Khj{ubhŒ.”…”�”}”(hj{h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kdhj_h²hubeh}”(h]”Œexecutor”ah ]”h"]”Œexecutor”ah$]”h&]”uh1hÈhjGh²hh³hÇh´KKubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒAssertion Macros”h]”hŒAssertion Macros”…”�”}”(hjÈh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÅh²hh³hÇh´KjubhÞ)�”}”(hŒ¦KUnit tests verify state using expectations/assertions. All expectations/assertions are formatted as: ``KUNIT_{EXPECT|ASSERT}_[_MSG](kunit, property[, message])``”h]”(hŒfKUnit tests verify state using expectations/assertions. All expectations/assertions are formatted as: ”…”�”}”(hjÖh²hh³Nh´NubjÏ)�”}”(hŒ@``KUNIT_{EXPECT|ASSERT}_[_MSG](kunit, property[, message])``”h]”hŒ[_MSG](kunit, property[, message])”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjÖubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KlhjÅh²hubhî)�”}”(hhh]”(hó)�”}”(hX0``{EXPECT|ASSERT}`` determines whether the check is an assertion or an expectation. In the event of a failure, the testing flow differs as follows: - For expectations, the test is marked as failed and the failure is logged. - Failing assertions, on the other hand, result in the test case being terminated immediately. - Assertions call the function: ``void __noreturn __kunit_abort(struct kunit *)``. - ``__kunit_abort`` calls the function: ``void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch)``. - ``kunit_try_catch_throw`` calls the function: ``void kthread_complete_and_exit(struct completion *, long) __noreturn;`` and terminates the special thread context. ”h]”(hÞ)�”}”(hŒ“``{EXPECT|ASSERT}`` determines whether the check is an assertion or an expectation. In the event of a failure, the testing flow differs as follows:”h]”(jÏ)�”}”(hŒ``{EXPECT|ASSERT}``”h]”hŒ{EXPECT|ASSERT}”…”�”}”(hjýh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjùubhŒ€ determines whether the check is an assertion or an expectation. In the event of a failure, the testing flow differs as follows:”…”�”}”(hjùh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KphjõubhŒ block_quote”“”)�”}”(hX_- For expectations, the test is marked as failed and the failure is logged. - Failing assertions, on the other hand, result in the test case being terminated immediately. - Assertions call the function: ``void __noreturn __kunit_abort(struct kunit *)``. - ``__kunit_abort`` calls the function: ``void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch)``. - ``kunit_try_catch_throw`` calls the function: ``void kthread_complete_and_exit(struct completion *, long) __noreturn;`` and terminates the special thread context. ”h]”hî)�”}”(hhh]”(hó)�”}”(hŒJFor expectations, the test is marked as failed and the failure is logged. ”h]”hÞ)�”}”(hŒIFor expectations, the test is marked as failed and the failure is logged.”h]”hŒIFor expectations, the test is marked as failed and the failure is logged.”…”�”}”(hj"h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kthjubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjubhó)�”}”(hXFailing assertions, on the other hand, result in the test case being terminated immediately. - Assertions call the function: ``void __noreturn __kunit_abort(struct kunit *)``. - ``__kunit_abort`` calls the function: ``void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch)``. - ``kunit_try_catch_throw`` calls the function: ``void kthread_complete_and_exit(struct completion *, long) __noreturn;`` and terminates the special thread context. ”h]”(hÞ)�”}”(hŒ\Failing assertions, on the other hand, result in the test case being terminated immediately.”h]”hŒ\Failing assertions, on the other hand, result in the test case being terminated immediately.”…”�”}”(hj:h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kvhj6ubj)�”}”(hXx- Assertions call the function: ``void __noreturn __kunit_abort(struct kunit *)``. - ``__kunit_abort`` calls the function: ``void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch)``. - ``kunit_try_catch_throw`` calls the function: ``void kthread_complete_and_exit(struct completion *, long) __noreturn;`` and terminates the special thread context. ”h]”hî)�”}”(hhh]”(hó)�”}”(hŒQAssertions call the function: ``void __noreturn __kunit_abort(struct kunit *)``. ”h]”hÞ)�”}”(hŒPAssertions call the function: ``void __noreturn __kunit_abort(struct kunit *)``.”h]”(hŒAssertions call the function: ”…”�”}”(hjSh²hh³Nh´NubjÏ)�”}”(hŒ1``void __noreturn __kunit_abort(struct kunit *)``”h]”hŒ-void __noreturn __kunit_abort(struct kunit *)”…”�”}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjSubhŒ.”…”�”}”(hjSh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KyhjOubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjLubhó)�”}”(hŒt``__kunit_abort`` calls the function: ``void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch)``. ”h]”hÞ)�”}”(hŒs``__kunit_abort`` calls the function: ``void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch)``.”h]”(jÏ)�”}”(hŒ``__kunit_abort``”h]”hŒ __kunit_abort”…”�”}”(hj�h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj}ubhŒ calls the function: ”…”�”}”(hj}h²hh³Nh´NubjÏ)�”}”(hŒL``void __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch)``”h]”hŒHvoid __noreturn kunit_try_catch_throw(struct kunit_try_catch *try_catch)”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj}ubhŒ.”…”�”}”(hj}h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K|hjyubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjLubhó)�”}”(hŒ£``kunit_try_catch_throw`` calls the function: ``void kthread_complete_and_exit(struct completion *, long) __noreturn;`` and terminates the special thread context. ”h]”hÞ)�”}”(hŒ¢``kunit_try_catch_throw`` calls the function: ``void kthread_complete_and_exit(struct completion *, long) __noreturn;`` and terminates the special thread context.”h]”(jÏ)�”}”(hŒ``kunit_try_catch_throw``”h]”hŒkunit_try_catch_throw”…”�”}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjµubhŒ calls the function: ”…”�”}”(hjµh²hh³Nh´NubjÏ)�”}”(hŒI``void kthread_complete_and_exit(struct completion *, long) __noreturn;``”h]”hŒEvoid kthread_complete_and_exit(struct completion *, long) __noreturn;”…”�”}”(hjËh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjµubhŒ+ and terminates the special thread context.”…”�”}”(hjµh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khj±ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjLubeh}”(h]”h ]”h"]”h$]”h&]”jEjFuh1híh³hÇh´KyhjHubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Kyhj6ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hòhjubeh}”(h]”h ]”h"]”h$]”h&]”jEjFuh1híh³hÇh´Kthjubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Kthjõubeh}”(h]”h ]”h"]”h$]”h&]”uh1hòhjòh²hh³hÇh´Nubhó)�”}”(hŒæ```` denotes a check with options: ``TRUE`` (supplied property has the boolean value "true"), ``EQ`` (two supplied properties are equal), ``NOT_ERR_OR_NULL`` (supplied pointer is not null and does not contain an "err" value). ”h]”hÞ)�”}”(hŒå```` denotes a check with options: ``TRUE`` (supplied property has the boolean value "true"), ``EQ`` (two supplied properties are equal), ``NOT_ERR_OR_NULL`` (supplied pointer is not null and does not contain an "err" value).”h]”(jÏ)�”}”(hŒ````”h]”hŒ”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhŒ denotes a check with options: ”…”�”}”(hjh²hh³Nh´NubjÏ)�”}”(hŒ``TRUE``”h]”hŒTRUE”…”�”}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhŒ7 (supplied property has the boolean value “trueâ€�), ”…”�”}”(hjh²hh³Nh´NubjÏ)�”}”(hŒ``EQ``”h]”hŒEQ”…”�”}”(hj9h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhŒ& (two supplied properties are equal), ”…”�”}”(hjh²hh³Nh´NubjÏ)�”}”(hŒ``NOT_ERR_OR_NULL``”h]”hŒNOT_ERR_OR_NULL”…”�”}”(hjKh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhŒH (supplied pointer is not null and does not contain an “errâ€� value).”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kƒhj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjòh²hh³hÇh´Nubhó)�”}”(hŒ/``[_MSG]`` prints a custom message on failure. ”h]”hÞ)�”}”(hŒ.``[_MSG]`` prints a custom message on failure.”h]”(jÏ)�”}”(hŒ ``[_MSG]``”h]”hŒ[_MSG]”…”�”}”(hjqh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjmubhŒ$ prints a custom message on failure.”…”�”}”(hjmh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kˆhjiubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjòh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jEjFuh1híh³hÇh´KphjÅh²hubeh}”(h]”Œassertion-macros”ah ]”h"]”Œassertion macros”ah$]”h&]”uh1hÈhjGh²hh³hÇh´KjubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒTest Result Reporting”h]”hŒTest Result Reporting”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj�h²hh³hÇh´K‹ubhÞ)�”}”(hŒÞKUnit prints the test results in KTAP format. KTAP is based on TAP14, see Documentation/dev-tools/ktap.rst. KTAP works with KUnit and Kselftest. The KUnit executor prints KTAP results to dmesg, and debugfs (if configured).”h]”hŒÞKUnit prints the test results in KTAP format. KTAP is based on TAP14, see Documentation/dev-tools/ktap.rst. KTAP works with KUnit and Kselftest. The KUnit executor prints KTAP results to dmesg, and debugfs (if configured).”…”�”}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KŒhj�h²hubeh}”(h]”Œtest-result-reporting”ah ]”h"]”Œtest result reporting”ah$]”h&]”uh1hÈhjGh²hh³hÇh´K‹ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒParameterized Tests”h]”hŒParameterized Tests”…”�”}”(hjÇh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÄh²hh³hÇh´K’ubhÞ)�”}”(hXÁEach KUnit parameterized test is associated with a collection of parameters. The test is invoked multiple times, once for each parameter value and the parameter is stored in the ``param_value`` field. The test case includes a KUNIT_CASE_PARAM() macro that accepts a generator function. The generator function is passed the previous parameter and returns the next parameter. It also includes a macro for generating array-based common-case generators.”h]”(hŒ²Each KUnit parameterized test is associated with a collection of parameters. The test is invoked multiple times, once for each parameter value and the parameter is stored in the ”…”�”}”(hjÕh²hh³Nh´NubjÏ)�”}”(hŒ``param_value``”h]”hŒ param_value”…”�”}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjÕubhX field. The test case includes a KUNIT_CASE_PARAM() macro that accepts a generator function. The generator function is passed the previous parameter and returns the next parameter. It also includes a macro for generating array-based common-case generators.”…”�”}”(hjÕh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K”hjÄh²hubeh}”(h]”Œparameterized-tests”ah ]”h"]”Œparameterized tests”ah$]”h&]”uh1hÈhjGh²hh³hÇh´K’ubeh}”(h]”j ah ]”h"]”Œin-kernel testing framework”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K j½KubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ&kunit_tool (Command-line Test Harness)”h]”hŒ&kunit_tool (Command-line Test Harness)”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjh²hh³hÇh´K�ubhÞ)�”}”(hXâ``kunit_tool`` is a Python script, found in ``tools/testing/kunit/kunit.py``. It is used to configure, build, execute, parse test results and run all of the previous commands in correct order (i.e., configure, build, execute and parse). You have two options for running KUnit tests: either build the kernel with KUnit enabled and manually parse the results (see Documentation/dev-tools/kunit/run_manual.rst) or use ``kunit_tool`` (see Documentation/dev-tools/kunit/run_wrapper.rst).”h]”(jÏ)�”}”(hŒ``kunit_tool``”h]”hŒ kunit_tool”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhŒ is a Python script, found in ”…”�”}”(hjh²hh³Nh´NubjÏ)�”}”(hŒ ``tools/testing/kunit/kunit.py``”h]”hŒtools/testing/kunit/kunit.py”…”�”}”(hj+h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhXS. It is used to configure, build, execute, parse test results and run all of the previous commands in correct order (i.e., configure, build, execute and parse). You have two options for running KUnit tests: either build the kernel with KUnit enabled and manually parse the results (see Documentation/dev-tools/kunit/run_manual.rst) or use ”…”�”}”(hjh²hh³Nh´NubjÏ)�”}”(hŒ``kunit_tool``”h]”hŒ kunit_tool”…”�”}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhjubhŒ5 (see Documentation/dev-tools/kunit/run_wrapper.rst).”…”�”}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KŸhjh²hubhî)�”}”(hhh]”(hó)�”}”(hXÎ``configure`` command generates the kernel ``.config`` from a ``.kunitconfig`` file (and any architecture-specific options). The Python scripts available in ``qemu_configs`` folder (for example, ``tools/testing/kunit/qemu configs/powerpc.py``) contains additional configuration options for specific architectures. It parses both the existing ``.config`` and the ``.kunitconfig`` files to ensure that ``.config`` is a superset of ``.kunitconfig``. If not, it will combine the two and run ``make olddefconfig`` to regenerate the ``.config`` file. It then checks to see if ``.config`` has become a superset. This verifies that all the Kconfig dependencies are correctly specified in the file ``.kunitconfig``. The ``kunit_config.py`` script contains the code for parsing Kconfigs. The code which runs ``make olddefconfig`` is part of the ``kunit_kernel.py`` script. You can invoke this command through: ``./tools/testing/kunit/kunit.py config`` and generate a ``.config`` file.”h]”hÞ)�”}”(hXÎ``configure`` command generates the kernel ``.config`` from a ``.kunitconfig`` file (and any architecture-specific options). The Python scripts available in ``qemu_configs`` folder (for example, ``tools/testing/kunit/qemu configs/powerpc.py``) contains additional configuration options for specific architectures. It parses both the existing ``.config`` and the ``.kunitconfig`` files to ensure that ``.config`` is a superset of ``.kunitconfig``. If not, it will combine the two and run ``make olddefconfig`` to regenerate the ``.config`` file. It then checks to see if ``.config`` has become a superset. This verifies that all the Kconfig dependencies are correctly specified in the file ``.kunitconfig``. The ``kunit_config.py`` script contains the code for parsing Kconfigs. The code which runs ``make olddefconfig`` is part of the ``kunit_kernel.py`` script. You can invoke this command through: ``./tools/testing/kunit/kunit.py config`` and generate a ``.config`` file.”h]”(jÏ)�”}”(hŒ ``configure``”h]”hŒ configure”…”�”}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ command generates the kernel ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ ``.config``”h]”hŒ.config”…”�”}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ from a ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ``.kunitconfig``”h]”hŒ .kunitconfig”…”�”}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒO file (and any architecture-specific options). The Python scripts available in ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ``qemu_configs``”h]”hŒ qemu_configs”…”�”}”(hj–h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ folder (for example, ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ/``tools/testing/kunit/qemu configs/powerpc.py``”h]”hŒ+tools/testing/kunit/qemu configs/powerpc.py”…”�”}”(hj¨h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒd) contains additional configuration options for specific architectures. It parses both the existing ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ ``.config``”h]”hŒ.config”…”�”}”(hjºh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ and the ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ``.kunitconfig``”h]”hŒ .kunitconfig”…”�”}”(hjÌh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ files to ensure that ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ ``.config``”h]”hŒ.config”…”�”}”(hjÞh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ is a superset of ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ``.kunitconfig``”h]”hŒ .kunitconfig”…”�”}”(hjðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ*. If not, it will combine the two and run ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ``make olddefconfig``”h]”hŒmake olddefconfig”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ to regenerate the ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ ``.config``”h]”hŒ.config”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ file. It then checks to see if ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ ``.config``”h]”hŒ.config”…”�”}”(hj&h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒl has become a superset. This verifies that all the Kconfig dependencies are correctly specified in the file ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ``.kunitconfig``”h]”hŒ .kunitconfig”…”�”}”(hj8h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ. The ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ``kunit_config.py``”h]”hŒkunit_config.py”…”�”}”(hjJh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒD script contains the code for parsing Kconfigs. The code which runs ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ``make olddefconfig``”h]”hŒmake olddefconfig”…”�”}”(hj\h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ is part of the ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ``kunit_kernel.py``”h]”hŒkunit_kernel.py”…”�”}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ. script. You can invoke this command through: ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ)``./tools/testing/kunit/kunit.py config``”h]”hŒ%./tools/testing/kunit/kunit.py config”…”�”}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ and generate a ”…”�”}”(hj\h²hh³Nh´NubjÏ)�”}”(hŒ ``.config``”h]”hŒ.config”…”�”}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj\ubhŒ file.”…”�”}”(hj\h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K§hjXubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjUh²hh³hÇh´Nubhó)�”}”(hX#``build`` runs ``make`` on the kernel tree with required options (depends on the architecture and some options, for example: build_dir) and reports any errors. To build a KUnit kernel from the current ``.config``, you can use the ``build`` argument: ``./tools/testing/kunit/kunit.py build``.”h]”hÞ)�”}”(hX#``build`` runs ``make`` on the kernel tree with required options (depends on the architecture and some options, for example: build_dir) and reports any errors. To build a KUnit kernel from the current ``.config``, you can use the ``build`` argument: ``./tools/testing/kunit/kunit.py build``.”h]”(jÏ)�”}”(hŒ ``build``”h]”hŒbuild”…”�”}”(hj¸h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj´ubhŒ runs ”…”�”}”(hj´h²hh³Nh´NubjÏ)�”}”(hŒ``make``”h]”hŒmake”…”�”}”(hjÊh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj´ubhŒ² on the kernel tree with required options (depends on the architecture and some options, for example: build_dir) and reports any errors. To build a KUnit kernel from the current ”…”�”}”(hj´h²hh³Nh´NubjÏ)�”}”(hŒ ``.config``”h]”hŒ.config”…”�”}”(hjÜh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj´ubhŒ, you can use the ”…”�”}”(hj´h²hh³Nh´NubjÏ)�”}”(hŒ ``build``”h]”hŒbuild”…”�”}”(hjîh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj´ubhŒ argument: ”…”�”}”(hj´h²hh³Nh´NubjÏ)�”}”(hŒ(``./tools/testing/kunit/kunit.py build``”h]”hŒ$./tools/testing/kunit/kunit.py build”…”�”}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj´ubhŒ.”…”�”}”(hj´h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K¶hj°ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjUh²hh³hÇh´Nubhó)�”}”(hX¤``exec`` command executes kernel results either directly (using User-mode Linux configuration), or through an emulator such as QEMU. It reads results from the log using standard output (stdout), and passes them to ``parse`` to be parsed. If you already have built a kernel with built-in KUnit tests, you can run the kernel and display the test results with the ``exec`` argument: ``./tools/testing/kunit/kunit.py exec``.”h]”hÞ)�”}”(hX¤``exec`` command executes kernel results either directly (using User-mode Linux configuration), or through an emulator such as QEMU. It reads results from the log using standard output (stdout), and passes them to ``parse`` to be parsed. If you already have built a kernel with built-in KUnit tests, you can run the kernel and display the test results with the ``exec`` argument: ``./tools/testing/kunit/kunit.py exec``.”h]”(jÏ)�”}”(hŒ``exec``”h]”hŒexec”…”�”}”(hj& h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj" ubhŒÎ command executes kernel results either directly (using User-mode Linux configuration), or through an emulator such as QEMU. It reads results from the log using standard output (stdout), and passes them to ”…”�”}”(hj" h²hh³Nh´NubjÏ)�”}”(hŒ ``parse``”h]”hŒparse”…”�”}”(hj8 h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj" ubhŒŠ to be parsed. If you already have built a kernel with built-in KUnit tests, you can run the kernel and display the test results with the ”…”�”}”(hj" h²hh³Nh´NubjÏ)�”}”(hŒ``exec``”h]”hŒexec”…”�”}”(hjJ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj" ubhŒ argument: ”…”�”}”(hj" h²hh³Nh´NubjÏ)�”}”(hŒ'``./tools/testing/kunit/kunit.py exec``”h]”hŒ#./tools/testing/kunit/kunit.py exec”…”�”}”(hj\ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj" ubhŒ.”…”�”}”(hj" h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K»hj ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjUh²hh³hÇh´Nubhó)�”}”(hŒž``parse`` extracts the KTAP output from a kernel log, parses the test results, and prints a summary. For failed tests, any diagnostic output will be included.”h]”hÞ)�”}”(hŒž``parse`` extracts the KTAP output from a kernel log, parses the test results, and prints a summary. For failed tests, any diagnostic output will be included.”h]”(jÏ)�”}”(hŒ ``parse``”h]”hŒparse”…”�”}”(hj‚ h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÎhj~ ubhŒ• extracts the KTAP output from a kernel log, parses the test results, and prints a summary. For failed tests, any diagnostic output will be included.”…”�”}”(hj~ h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KÂhjz ubah}”(h]”h ]”h"]”h$]”h&]”uh1hòhjUh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”jEjFuh1híh³hÇh´K§hjh²hubeh}”(h]”j2ah ]”h"]”Œ&kunit_tool (command-line test harness)”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K�j½Kubeh}”(h]”Œkunit-architecture”ah ]”h"]”Œkunit architecture”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)�”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jØ Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”(Œin-kernel testing framework”]”hýaŒ&kunit_tool (command-line test harness)”]”j#auŒrefids”}”Œnameids”}”(j² j¯ jj j‚jj\jYjÂj¿j¹j¶jIjFj¯j¬jšj—jÁj¾júj÷jª j2uŒ nametypes”}”(j² ‰j‰j‚‰j\‰j‰j¹ˆjIˆj¯ˆjš‰jÁ‰jú‰jª ‰uh}”(j¯ hÊj jGjjµjYj…j¿j_j¶j°jFj@j¬j¦j—jÅj¾j�j÷jÄj2jjjôuŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”jæ Ks…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.