€•¸=Œ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/run_manual”Œ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/run_manual”Œ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/run_manual”Œ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/run_manual”Œ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/run_manual”Œ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/run_manual”Œ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ŸŒH/var/lib/git/docbuild/linux/Documentation/dev-tools/kunit/run_manual.rst”h KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒRun Tests without kunit_tool”h]”hŒRun Tests without kunit_tool”…””}”(hh»hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hh¶hžhhŸh³h KubhŒ paragraph”“”)”}”(hŒÄIf we do not want to use kunit_tool (For example: we want to integrate with other systems, or run tests on real hardware), we can include KUnit in any kernel, read out results, and parse manually.”h]”hŒÄIf we do not want to use kunit_tool (For example: we want to integrate with other systems, or run tests on real hardware), we can include KUnit in any kernel, read out results, and parse manually.”…””}”(hhËhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khh¶hžhubhŒnote”“”)”}”(hŒƒKUnit is not designed for use in a production system. It is possible that tests may reduce the stability or security of the system.”h]”hÊ)”}”(hŒƒKUnit is not designed for use in a production system. It is possible that tests may reduce the stability or security of the system.”h]”hŒƒKUnit is not designed for use in a production system. It is possible that tests may reduce the stability or security of the system.”…””}”(hhßhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K hhÛubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙhh¶hžhhŸh³h Nubhµ)”}”(hhh]”(hº)”}”(hŒConfigure the Kernel”h]”hŒConfigure the Kernel”…””}”(hhöhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hhóhžhhŸh³h KubhÊ)”}”(hŒ?KUnit tests can run without kunit_tool. This can be useful, if:”h]”hŒ?KUnit tests can run without kunit_tool. This can be useful, if:”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhhóhžhubhŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ1We have an existing kernel configuration to test.”h]”hÊ)”}”(hjh]”hŒ1We have an existing kernel configuration to test.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjhžhhŸh³h Nubj)”}”(hŒSNeed to run on real hardware (or using an emulator/VM kunit_tool does not support).”h]”hÊ)”}”(hŒSNeed to run on real hardware (or using an emulator/VM kunit_tool does not support).”h]”hŒSNeed to run on real hardware (or using an emulator/VM kunit_tool does not support).”…””}”(hj4hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khj0ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjhžhhŸh³h Nubj)”}”(hŒ6Wish to integrate with some existing testing systems. ”h]”hÊ)”}”(hŒ5Wish to integrate with some existing testing systems.”h]”hŒ5Wish to integrate with some existing testing systems.”…””}”(hjLhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjHubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjhžhhŸh³h Nubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1jhŸh³h KhhóhžhubhÊ)”}”(hX0KUnit is configured with the ``CONFIG_KUNIT`` option, and individual tests can also be built by enabling their config options in our ``.config``. KUnit tests usually (but don't always) have config options ending in ``_KUNIT_TEST``. Most tests can either be built as a module, or be built into the kernel.”h]”(hŒKUnit is configured with the ”…””}”(hjhhžhhŸNh NubhŒliteral”“”)”}”(hŒ``CONFIG_KUNIT``”h]”hŒ CONFIG_KUNIT”…””}”(hjrhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphjhubhŒX option, and individual tests can also be built by enabling their config options in our ”…””}”(hjhhžhhŸNh Nubjq)”}”(hŒ ``.config``”h]”hŒ.config”…””}”(hj„hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphjhubhŒI. KUnit tests usually (but don’t always) have config options ending in ”…””}”(hjhhžhhŸNh Nubjq)”}”(hŒ``_KUNIT_TEST``”h]”hŒ _KUNIT_TEST”…””}”(hj–hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphjhubhŒJ. Most tests can either be built as a module, or be built into the kernel.”…””}”(hjhhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhhóhžhubhÚ)”}”(hŒÅWe can enable the ``KUNIT_ALL_TESTS`` config option to automatically enable all tests with satisfied dependencies. This is a good way of quickly testing everything applicable to the current config.”h]”hÊ)”}”(hŒÅWe can enable the ``KUNIT_ALL_TESTS`` config option to automatically enable all tests with satisfied dependencies. This is a good way of quickly testing everything applicable to the current config.”h]”(hŒWe can enable the ”…””}”(hj²hžhhŸNh Nubjq)”}”(hŒ``KUNIT_ALL_TESTS``”h]”hŒKUNIT_ALL_TESTS”…””}”(hjºhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphj²ubhŒ  config option to automatically enable all tests with satisfied dependencies. This is a good way of quickly testing everything applicable to the current config.”…””}”(hj²hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K!hj®ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙhhóhžhhŸh³h NubhÊ)”}”(hŒâOnce we have built our kernel (and/or modules), it is simple to run the tests. If the tests are built-in, they will run automatically on the kernel boot. The results will be written to the kernel log (``dmesg``) in TAP format.”h]”(hŒÉOnce we have built our kernel (and/or modules), it is simple to run the tests. If the tests are built-in, they will run automatically on the kernel boot. The results will be written to the kernel log (”…””}”(hjØhžhhŸNh Nubjq)”}”(hŒ ``dmesg``”h]”hŒdmesg”…””}”(hjàhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphjØubhŒ) in TAP format.”…””}”(hjØhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K&hhóhžhubhÊ)”}”(hŒKIf the tests are built as modules, they will run when the module is loaded.”h]”hŒKIf the tests are built as modules, they will run when the module is loaded.”…””}”(hjøhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K+hhóhžhubhŒ literal_block”“”)”}”(hŒ# modprobe example-test”h]”hŒ# modprobe example-test”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”h±h²Œforce”‰Œlanguage”Œbash”Œhighlight_args”}”uh1jhŸh³h K.hhóhžhubhÊ)”}”(hŒ3The results will appear in TAP format in ``dmesg``.”h]”(hŒ)The results will appear in TAP format in ”…””}”(hjhžhhŸNh Nubjq)”}”(hŒ ``dmesg``”h]”hŒdmesg”…””}”(hj#hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphjubhŒ.”…””}”(hjhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K2hhóhžhubeh}”(h]”Œconfigure-the-kernel”ah ]”h"]”Œconfigure the kernel”ah$]”h&]”uh1h´hh¶hžhhŸh³h Kubhµ)”}”(hhh]”(hº)”}”(hŒdebugfs”h]”hŒdebugfs”…””}”(hjFhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjChžhhŸh³h K5ubhÊ)”}”(hŒŽKUnit can be accessed from userspace via the debugfs filesystem (See more information about debugfs at Documentation/filesystems/debugfs.rst).”h]”hŒŽKUnit can be accessed from userspace via the debugfs filesystem (See more information about debugfs at Documentation/filesystems/debugfs.rst).”…””}”(hjThžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K7hjChžhubhÊ)”}”(hŒ©If ``CONFIG_KUNIT_DEBUGFS`` is enabled, the KUnit debugfs filesystem is mounted at /sys/kernel/debug/kunit. You can use this filesystem to perform the following actions.”h]”(hŒIf ”…””}”(hjbhžhhŸNh Nubjq)”}”(hŒ``CONFIG_KUNIT_DEBUGFS``”h]”hŒCONFIG_KUNIT_DEBUGFS”…””}”(hjjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphjbubhŒŽ is enabled, the KUnit debugfs filesystem is mounted at /sys/kernel/debug/kunit. You can use this filesystem to perform the following actions.”…””}”(hjbhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K:hjChžhubeh}”(h]”Œdebugfs”ah ]”h"]”Œdebugfs”ah$]”h&]”uh1h´hh¶hžhhŸh³h K5ubhµ)”}”(hhh]”(hº)”}”(hŒRetrieve Test Results”h]”hŒRetrieve Test Results”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjŠhžhhŸh³h K?ubhÊ)”}”(hŒYou can use debugfs to retrieve KUnit test results. The test results are accessible from the debugfs filesystem in the following read-only file:”h]”hŒYou can use debugfs to retrieve KUnit test results. The test results are accessible from the debugfs filesystem in the following read-only file:”…””}”(hj›hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KAhjŠhžhubj)”}”(hŒ,/sys/kernel/debug/kunit//results”h]”hŒ,/sys/kernel/debug/kunit//results”…””}”hj©sbah}”(h]”h ]”h"]”h$]”h&]”h±h²j‰jŒbash”j}”uh1jhŸh³h KDhjŠhžhubhÊ)”}”(hŒ”The test results are printed in a KTAP document. Note this document is separate to the kernel log and thus, may have different test suite numbering.”h]”hŒ”The test results are printed in a KTAP document. Note this document is separate to the kernel log and thus, may have different test suite numbering.”…””}”(hj¹hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KHhjŠhžhubeh}”(h]”Œretrieve-test-results”ah ]”h"]”Œretrieve test results”ah$]”h&]”uh1h´hh¶hžhhŸh³h K?ubhµ)”}”(hhh]”(hº)”}”(hŒ!Run Tests After Kernel Has Booted”h]”hŒ!Run Tests After Kernel Has Booted”…””}”(hjÒhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjÏhžhhŸh³h KLubhÊ)”}”(hŒËYou can use the debugfs filesystem to trigger built-in tests to run after boot. To run the test suite, you can use the following command to write to the ``/sys/kernel/debug/kunit//run`` file:”h]”(hŒ™You can use the debugfs filesystem to trigger built-in tests to run after boot. To run the test suite, you can use the following command to write to the ”…””}”(hjàhžhhŸNh Nubjq)”}”(hŒ,``/sys/kernel/debug/kunit//run``”h]”hŒ(/sys/kernel/debug/kunit//run”…””}”(hjèhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphjàubhŒ file:”…””}”(hjàhžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KNhjÏhžhubj)”}”(hŒ>echo "any string" > /sys/kernel/debugfs/kunit//run”h]”hŒ>echo "any string" > /sys/kernel/debugfs/kunit//run”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”h±h²j‰jŒbash”j}”uh1jhŸh³h KRhjÏhžhubhÊ)”}”(hŒOAs a result, the test suite runs and the results are printed to the kernel log.”h]”hŒOAs a result, the test suite runs and the results are printed to the kernel log.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KVhjÏhžhubhÊ)”}”(hŒòHowever, this feature is not available with KUnit suites that use init data, because init data may have been discarded after the kernel boots. KUnit suites that use init data should be defined using the kunit_test_init_section_suites() macro.”h]”hŒòHowever, this feature is not available with KUnit suites that use init data, because init data may have been discarded after the kernel boots. KUnit suites that use init data should be defined using the kunit_test_init_section_suites() macro.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KYhjÏhžhubhÊ)”}”(hŒˆAlso, you cannot use this feature to run tests concurrently. Instead a test will wait to run until other tests have completed or failed.”h]”hŒˆAlso, you cannot use this feature to run tests concurrently. Instead a test will wait to run until other tests have completed or failed.”…””}”(hj,hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K^hjÏhžhubhÚ)”}”(hŒ’For test authors, to use this feature, tests will need to correctly initialise and/or clean up any data, so the test runs correctly a second time.”h]”hÊ)”}”(hŒ’For test authors, to use this feature, tests will need to correctly initialise and/or clean up any data, so the test runs correctly a second time.”h]”hŒ’For test authors, to use this feature, tests will need to correctly initialise and/or clean up any data, so the test runs correctly a second time.”…””}”(hj>hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Kchj:ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÙhjÏhžhhŸh³h Nubeh}”(h]”Œ!run-tests-after-kernel-has-booted”ah ]”h"]”Œ!run tests after kernel has booted”ah$]”h&]”uh1h´hh¶hžhhŸh³h KLubeh}”(h]”Œrun-tests-without-kunit-tool”ah ]”h"]”Œrun tests without kunit_tool”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”}”Œrefids”}”Œnameids”}”(j_j\j@j=j‡j„jÌjÉjWjTuŒ nametypes”}”(j_‰j@‰j‡‰j̉jW‰uh}”(j\h¶j=hój„jCjÉjŠjTjÏ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”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.