€•–AŒ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Ú)”}”(hXí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. KUnit can be enabled or disabled at boot time, and this behavior is controlled by the kunit.enable kernel parameter. By default, kunit.enable is set to 1 because KUNIT_DEFAULT_ENABLED is enabled by default. To ensure that tests are executed as expected, verify that kunit.enable=1 at boot time.”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®ubhÊ)”}”(hX&KUnit can be enabled or disabled at boot time, and this behavior is controlled by the kunit.enable kernel parameter. By default, kunit.enable is set to 1 because KUNIT_DEFAULT_ENABLED is enabled by default. To ensure that tests are executed as expected, verify that kunit.enable=1 at boot time.”h]”hX&KUnit can be enabled or disabled at boot time, and this behavior is controlled by the kunit.enable kernel parameter. By default, kunit.enable is set to 1 because KUNIT_DEFAULT_ENABLED is enabled by default. To ensure that tests are executed as expected, verify that kunit.enable=1 at boot time.”…””}”(hjÒhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K&hj®ubeh}”(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.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K1hhó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 K4hhóhžhubhÊ)”}”(hŒ3The results will appear in TAP format in ``dmesg``.”h]”(hŒ)The results will appear in TAP format in ”…””}”(hj)hžhhŸNh Nubjq)”}”(hŒ ``dmesg``”h]”hŒdmesg”…””}”(hj1hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphj)ubhŒ.”…””}”(hj)hžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K8hhó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”…””}”(hjThžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjQhžhhŸh³h K;ubhÊ)”}”(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).”…””}”(hjbhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K=hjQhž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 ”…””}”(hjphžhhŸNh Nubjq)”}”(hŒ``CONFIG_KUNIT_DEBUGFS``”h]”hŒCONFIG_KUNIT_DEBUGFS”…””}”(hjxhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jphjpubhŒŽ is enabled, the KUnit debugfs filesystem is mounted at /sys/kernel/debug/kunit. You can use this filesystem to perform the following actions.”…””}”(hjphžhhŸNh Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K@hjQhžhubeh}”(h]”Œdebugfs”ah ]”h"]”Œdebugfs”ah$]”h&]”uh1h´hh¶hžhhŸh³h K;ubhµ)”}”(hhh]”(hº)”}”(hŒRetrieve Test Results”h]”hŒRetrieve Test Results”…””}”(hj›hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj˜hžhhŸh³h KEubhÊ)”}”(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 KGhj˜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 KJhj˜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 KNhj˜hžhubeh}”(h]”Œretrieve-test-results”ah ]”h"]”Œretrieve test results”ah$]”h&]”uh1h´hh¶hžhhŸh³h KEubhµ)”}”(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 KRubhÊ)”}”(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 KThjÝ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 KXhjÝ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 K\hjÝ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.”…””}”(hj,hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K_hjÝ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 KdhjÝ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.”…””}”(hjLhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KihjHubah}”(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 KRubeh}”(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”}”(jmjjjNjKj•j’jÚj×jejbuŒ nametypes”}”(jm‰jN‰j•‰jÚ‰je‰uh}”(jjh¶jKhój’jQj×j˜jbjÝ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.