€•IFŒ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”Œ)/translations/zh_CN/dev-tools/kunit/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)�”}”(hhh]”hŒChinese (Traditional)”…”�”}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/zh_TW/dev-tools/kunit/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒItalian”…”�”}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/it_IT/dev-tools/kunit/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒJapanese”…”�”}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/ja_JP/dev-tools/kunit/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒKorean”…”�”}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/ko_KR/dev-tools/kunit/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒPortuguese (Brazilian)”…”�”}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/pt_BR/dev-tools/kunit/index”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)�”}”(hhh]”hŒSpanish”…”�”}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ)/translations/sp_SP/dev-tools/kunit/index”Œ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³ŒC/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/index.rst”h´KubhŒsection”“”)�”}”(hhh]”(hŒtitle”“”)�”}”(hŒ!KUnit - Linux Kernel Unit Testing”h]”hŒ!KUnit - Linux Kernel Unit Testing”…”�”}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒcompound”“”)�”}”(hhh]”hŒtoctree”“”)�”}”(hhh]”h}”(h]”h ]”h"]”h$]”h&]”hŒdev-tools/kunit/index”Œentries”]”(NŒdev-tools/kunit/start”†”NŒdev-tools/kunit/architecture”†”NŒdev-tools/kunit/run_wrapper”†”NŒdev-tools/kunit/run_manual”†”NŒdev-tools/kunit/usage”†”NŒdev-tools/kunit/api/index”†”NŒdev-tools/kunit/style”†”NŒdev-tools/kunit/faq”†”NŒdev-tools/kunit/running_tips”†”eŒ includefiles”]”(hðhòhôhöhøhúhühþjeŒmaxdepth”KŒcaption”Œ Contents:”Œglob”‰Œhidden”‰Œ includehidden”‰Œnumbered”KŒ titlesonly”‰Œ rawentries”]”Œ rawcaption”juh1hâh³hÇh´Khhßubah}”(h]”h ]”Œtoctree-wrapper”ah"]”h$]”h&]”uh1hÝhhÊh²hh³hÇh´NubhŒ paragraph”“”)�”}”(hŒ7This section details the kernel unit testing framework.”h]”hŒ7This section details the kernel unit testing framework.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´KhhÊh²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Introduction”h]”hŒ Introduction”…”�”}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj&h²hh³hÇh´Kubj)�”}”(hX KUnit (Kernel unit testing framework) provides a common framework for unit tests within the Linux kernel. Using KUnit, you can define groups of test cases called test suites. The tests either run on kernel boot if built-in, or load as a module. KUnit automatically flags and reports failed test cases in the kernel log. The test results appear in :doc:`KTAP (Kernel - Test Anything Protocol) format`. It is inspired by JUnit, Python’s unittest.mock, and GoogleTest/GoogleMock (C++ unit testing framework).”h]”(hX[KUnit (Kernel unit testing framework) provides a common framework for unit tests within the Linux kernel. Using KUnit, you can define groups of test cases called test suites. The tests either run on kernel boot if built-in, or load as a module. KUnit automatically flags and reports failed test cases in the kernel log. The test results appear in ”…”�”}”(hj7h²hh³Nh´Nubh)�”}”(hŒE:doc:`KTAP (Kernel - Test Anything Protocol) format`”h]”hŒinline”“”)�”}”(hjAh]”hŒ-KTAP (Kernel - Test Anything Protocol) format”…”�”}”(hjEh²hh³Nh´Nubah}”(h]”h ]”(Œxref”Œstd”Œstd-doc”eh"]”h$]”h&]”uh1jChj?ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”híŒ refdomain”jPŒreftype”Œdoc”Œ refexplicit”ˆŒrefwarn”ˆŒ reftarget”Œ/dev-tools/ktap”uh1hh³hÇh´Khj7ubhŒl. It is inspired by JUnit, Python’s unittest.mock, and GoogleTest/GoogleMock (C++ unit testing framework).”…”�”}”(hj7h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Khj&h²hubj)�”}”(hX�KUnit tests are part of the kernel, written in the C (programming) language, and test parts of the Kernel implementation (example: a C language function). Excluding build time, from invocation to completion, KUnit can run around 100 tests in less than 10 seconds. KUnit can test any kernel component, for example: file system, system calls, memory management, device drivers and so on.”h]”hX�KUnit tests are part of the kernel, written in the C (programming) language, and test parts of the Kernel implementation (example: a C language function). Excluding build time, from invocation to completion, KUnit can run around 100 tests in less than 10 seconds. KUnit can test any kernel component, for example: file system, system calls, memory management, device drivers and so on.”…”�”}”(hjmh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K#hj&h²hubj)�”}”(hŒµKUnit follows the white-box testing approach. The test has access to internal system functionality. KUnit runs in kernel space and is not restricted to things exposed to user-space.”h]”hŒµKUnit follows the white-box testing approach. The test has access to internal system functionality. KUnit runs in kernel space and is not restricted to things exposed to user-space.”…”�”}”(hj{h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K*hj&h²hubj)�”}”(hXIn addition, KUnit has kunit_tool, a script (``tools/testing/kunit/kunit.py``) that configures the Linux kernel, runs KUnit tests under QEMU or UML (:doc:`User Mode Linux `), parses the test results and displays them in a user friendly manner.”h]”(hŒ-In addition, KUnit has kunit_tool, a script (”…”�”}”(hj‰h²hh³Nh´NubhŒliteral”“”)�”}”(hŒ ``tools/testing/kunit/kunit.py``”h]”hŒtools/testing/kunit/kunit.py”…”�”}”(hj“h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j‘hj‰ubhŒH) that configures the Linux kernel, runs KUnit tests under QEMU or UML (”…”�”}”(hj‰h²hh³Nh´Nubh)�”}”(hŒ;:doc:`User Mode Linux `”h]”jD)�”}”(hj§h]”hŒUser Mode Linux”…”�”}”(hj©h²hh³Nh´Nubah}”(h]”h ]”(jOŒstd”Œstd-doc”eh"]”h$]”h&]”uh1jChj¥ubah}”(h]”h ]”h"]”h$]”h&]”Œrefdoc”híŒ refdomain”j³Œreftype”Œdoc”Œ refexplicit”ˆŒrefwarn”ˆjaŒ"/virt/uml/user_mode_linux_howto_v2”uh1hh³hÇh´K.hj‰ubhŒG), parses the test results and displays them in a user friendly manner.”…”�”}”(hj‰h²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K.hj&h²hubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒFeatures”h]”hŒFeatures”…”�”}”(hjÒh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjÏh²hh³hÇh´K5ubhŒ bullet_list”“”)�”}”(hhh]”(hŒ list_item”“”)�”}”(hŒ,Provides a framework for writing unit tests.”h]”j)�”}”(hjéh]”hŒ,Provides a framework for writing unit tests.”…”�”}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K7hjçubah}”(h]”h ]”h"]”h$]”h&]”uh1jåhjâh²hh³hÇh´Nubjæ)�”}”(hŒ&Runs tests on any kernel architecture.”h]”j)�”}”(hjh]”hŒ&Runs tests on any kernel architecture.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K8hjþubah}”(h]”h ]”h"]”h$]”h&]”uh1jåhjâh²hh³hÇh´Nubjæ)�”}”(hŒRuns a test in milliseconds. ”h]”j)�”}”(hŒRuns a test in milliseconds.”h]”hŒRuns a test in milliseconds.”…”�”}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´K9hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jåhjâh²hh³hÇh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1jàh³hÇh´K7hjÏh²hubeh}”(h]”Œfeatures”ah ]”h"]”Œfeatures”ah$]”h&]”uh1hÈhj&h²hh³hÇh´K5ubhÉ)�”}”(hhh]”(hÎ)�”}”(hŒ Prerequisites”h]”hŒ Prerequisites”…”�”}”(hj@h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj=h²hh³hÇh´KhjQubah}”(h]”h ]”h"]”h$]”h&]”uh1jåhjNh²hh³hÇh´Nubjæ)�”}”(hŒhj=h²hubeh}”(h]”Œ prerequisites”ah ]”h"]”Œ prerequisites”ah$]”h&]”uh1hÈhj&h²hh³hÇh´K