\sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget"/translations/zh_CN/dev-tools/ktapmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/zh_TW/dev-tools/ktapmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/it_IT/dev-tools/ktapmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/ja_JP/dev-tools/ktapmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/ko_KR/dev-tools/ktapmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget"/translations/sp_SP/dev-tools/ktapmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh`_. The Linux Kernel largely uses TAP output for test results. However, Kernel testing frameworks have special needs for test results which don't align with the original TAP specification. Thus, a "Kernel TAP" (KTAP) format is specified to extend and alter TAP to support these use-cases. This specification describes the generally accepted format of KTAP as it is currently used in the kernel.h](hTAP, or the Test Anything Protocol is a format for specifying test results used by a number of projects. It’s website and specification are found at this }(hhhhhNhNubh reference)}(h#`link `_h]hlink}(hhhhhNhNubah}(h]h ]h"]h$]h&]namelinkrefurihttps://testanything.org/uh1hhhubhtarget)}(h h]h}(h]linkah ]h"]linkah$]h&]refurihuh1h referencedKhhubhX. The Linux Kernel largely uses TAP output for test results. However, Kernel testing frameworks have special needs for test results which don’t align with the original TAP specification. Thus, a “Kernel TAP” (KTAP) format is specified to extend and alter TAP to support these use-cases. This specification describes the generally accepted format of KTAP as it is currently used in the kernel.}(hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hX@KTAP test results describe a series of tests (which may be nested: i.e., test can have subtests), each of which can contain both diagnostic data -- e.g., log lines -- and a final result. The test structure and results are machine-readable, whereas the diagnostic data is unstructured and is there to aid human debugging.h]hX@KTAP test results describe a series of tests (which may be nested: i.e., test can have subtests), each of which can contain both diagnostic data -- e.g., log lines -- and a final result. The test structure and results are machine-readable, whereas the diagnostic data is unstructured and is there to aid human debugging.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hKTAP output is built from four different types of lines: - Version lines - Plan lines - Test case result lines - Diagnostic linesh]hKTAP output is built from four different types of lines: - Version lines - Plan lines - Test case result lines - Diagnostic lines}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXQIn general, valid KTAP output should also form valid TAP output, but some information, in particular nested test results, may be lost. Also note that there is a stagnant draft specification for TAP14, KTAP diverges from this in a couple of places (notably the "Subtest" header), which are described where relevant later in this document.h]hXUIn general, valid KTAP output should also form valid TAP output, but some information, in particular nested test results, may be lost. Also note that there is a stagnant draft specification for TAP14, KTAP diverges from this in a couple of places (notably the “Subtest” header), which are described where relevant later in this document.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(h Version linesh]h Version lines}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj+hhhhhK#ubh)}(hAll KTAP-formatted results begin with a "version line" which specifies which version of the (K)TAP standard the result is compliant with.h]hAll KTAP-formatted results begin with a “version line” which specifies which version of the (K)TAP standard the result is compliant with.}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hj+hhubh)}(hEFor example: - "KTAP version 1" - "TAP version 13" - "TAP version 14"h]hQFor example: - “KTAP version 1” - “TAP version 13” - “TAP version 14”}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hj+hhubh)}(hNote that, in KTAP, subtests also begin with a version line, which denotes the start of the nested test results. This differs from TAP14, which uses a separate "Subtest" line.h]hNote that, in KTAP, subtests also begin with a version line, which denotes the start of the nested test results. This differs from TAP14, which uses a separate “Subtest” line.}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hj+hhubh)}(hWhile, going forward, "KTAP version 1" should be used by compliant tests, it is expected that most parsers and other tooling will accept the other versions listed here for compatibility with existing tests and frameworks.h]hWhile, going forward, “KTAP version 1” should be used by compliant tests, it is expected that most parsers and other tooling will accept the other versions listed here for compatibility with existing tests and frameworks.}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hj+hhubeh}(h] version-linesah ]h"] version linesah$]h&]uh1hhhhhhhhK#ubh)}(hhh](h)}(h Plan linesh]h Plan lines}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhj|hhhhhK6ubh)}(hJA test plan provides the number of tests (or subtests) in the KTAP output.h]hJA test plan provides the number of tests (or subtests) in the KTAP output.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK8hj|hhubh)}(hPlan lines must follow the format of "1..N" where N is the number of tests or subtests. Plan lines follow version lines to indicate the number of nested tests.h]hPlan lines must follow the format of “1..N” where N is the number of tests or subtests. Plan lines follow version lines to indicate the number of nested tests.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hj|hhubh)}(hWhile there are cases where the number of tests is not known in advance -- in which case the test plan may be omitted -- it is strongly recommended one is present where possible.h]hWhile there are cases where the number of tests is not known in advance -- in which case the test plan may be omitted -- it is strongly recommended one is present where possible.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK=hj|hhubeh}(h] plan-linesah ]h"] plan linesah$]h&]uh1hhhhhhhhK6ubh)}(hhh](h)}(hTest case result linesh]hTest case result lines}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKBubh)}(hgTest case result lines indicate the final status of a test. They are required and must have the format:h]hgTest case result lines indicate the final status of a test. They are required and must have the format:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKDhjhhubh literal_block)}(hG [][ # [] []]h]hG [][ # [] []]}hjsbah}(h]h ]h"]h$]h&]hhforcelanguagenonehighlight_args}uh1jhhhKGhjhhubh)}(h|The result can be either "ok", which indicates the test case passed, or "not ok", which indicates that the test case failed.h]hThe result can be either “ok”, which indicates the test case passed, or “not ok”, which indicates that the test case failed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhjhhubh)}(h represents the number of the test being performed. The first test must have the number 1 and the number then must increase by 1 for each additional subtest within the same test at the same nesting level.h]h represents the number of the test being performed. The first test must have the number 1 and the number then must increase by 1 for each additional subtest within the same test at the same nesting level.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhjhhubh)}(hThe description is a description of the test, generally the name of the test, and can be any string of characters other than # or a newline. The description is optional, but recommended.h]hThe description is a description of the test, generally the name of the test, and can be any string of characters other than # or a newline. The description is optional, but recommended.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKRhjhhubh)}(hlThe directive and any diagnostic data is optional. If either are present, they must follow a hash sign, "#".h]hpThe directive and any diagnostic data is optional. If either are present, they must follow a hash sign, “#”.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKVhjhhubh)}(hX8A directive is a keyword that indicates a different outcome for a test other than passed and failed. The directive is optional, and consists of a single keyword preceding the diagnostic data. In the event that a parser encounters a directive it doesn't support, it should fall back to the "ok" / "not ok" result.h]hXBA directive is a keyword that indicates a different outcome for a test other than passed and failed. The directive is optional, and consists of a single keyword preceding the diagnostic data. In the event that a parser encounters a directive it doesn’t support, it should fall back to the “ok” / “not ok” result.}(hj+hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKYhjhhubh)}(h"Currently accepted directives are:h]h"Currently accepted directives are:}(hj9hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK_hjhhubh bullet_list)}(hhh](h list_item)}(h"SKIP", which indicates a test was skipped (note the result of the test case result line can be either "ok" or "not ok" if the SKIP directive is used)h]h)}(h"SKIP", which indicates a test was skipped (note the result of the test case result line can be either "ok" or "not ok" if the SKIP directive is used)h]h“SKIP”, which indicates a test was skipped (note the result of the test case result line can be either “ok” or “not ok” if the SKIP directive is used)}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKahjNubah}(h]h ]h"]h$]h&]uh1jLhjIhhhhhNubjM)}(h"TODO", which indicates that a test is not expected to pass at the moment, e.g. because the feature it is testing is known to be broken. While this directive is inherited from TAP, its use in the kernel is discouraged.h]h)}(h"TODO", which indicates that a test is not expected to pass at the moment, e.g. because the feature it is testing is known to be broken. While this directive is inherited from TAP, its use in the kernel is discouraged.h]h“TODO”, which indicates that a test is not expected to pass at the moment, e.g. because the feature it is testing is known to be broken. While this directive is inherited from TAP, its use in the kernel is discouraged.}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKchjfubah}(h]h ]h"]h$]h&]uh1jLhjIhhhhhNubjM)}(h"XFAIL", which indicates that a test is expected to fail. This is similar to "TODO", above, and is used by some kselftest tests.h]h)}(h"XFAIL", which indicates that a test is expected to fail. This is similar to "TODO", above, and is used by some kselftest tests.h]h“XFAIL”, which indicates that a test is expected to fail. This is similar to “TODO”, above, and is used by some kselftest tests.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKfhj~ubah}(h]h ]h"]h$]h&]uh1jLhjIhhhhhNubjM)}(h“TIMEOUT”, which indicates a test has timed out (note the result of the test case result line should be “not ok” if the TIMEOUT directive is used)h]h)}(h“TIMEOUT”, which indicates a test has timed out (note the result of the test case result line should be “not ok” if the TIMEOUT directive is used)h]h“TIMEOUT”, which indicates a test has timed out (note the result of the test case result line should be “not ok” if the TIMEOUT directive is used)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhjubah}(h]h ]h"]h$]h&]uh1jLhjIhhhhhNubjM)}(h“ERROR”, which indicates that the execution of a test has failed due to a specific error that is included in the diagnostic data. (note the result of the test case result line should be “not ok” if the ERROR directive is used) h]h)}(h“ERROR”, which indicates that the execution of a test has failed due to a specific error that is included in the diagnostic data. (note the result of the test case result line should be “not ok” if the ERROR directive is used)h]h“ERROR”, which indicates that the execution of a test has failed due to a specific error that is included in the diagnostic data. (note the result of the test case result line should be “not ok” if the ERROR directive is used)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKjhjubah}(h]h ]h"]h$]h&]uh1jLhjIhhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1jGhhhKahjhhubh)}(hThe diagnostic data is a plain-text field which contains any additional details about why this result was produced. This is typically an error message for ERROR or failed tests, or a description of missing dependencies for a SKIP result.h]hThe diagnostic data is a plain-text field which contains any additional details about why this result was produced. This is typically an error message for ERROR or failed tests, or a description of missing dependencies for a SKIP result.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKnhjhhubh)}(hThe diagnostic data field is optional, and results which have neither a directive nor any diagnostic data do not need to include the "#" field separator.h]hThe diagnostic data field is optional, and results which have neither a directive nor any diagnostic data do not need to include the “#” field separator.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKrhjhhubh)}(hExample result lines include::h]hExample result lines include:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKvhjhhubj)}(hok 1 test_case_nameh]hok 1 test_case_name}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKxhjhhubh)}(h!The test "test_case_name" passed.h]h%The test “test_case_name” passed.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKzhjhhubj)}(hnot ok 1 test_case_nameh]hnot ok 1 test_case_name}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK~hjhhubh)}(h!The test "test_case_name" failed.h]h%The test “test_case_name” failed.}(hj"hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h1ok 1 test # SKIP necessary dependency unavailableh]h1ok 1 test # SKIP necessary dependency unavailable}hj0sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h[The test "test" was SKIPPED with the diagnostic message "necessary dependency unavailable".h]hcThe test “test” was SKIPPED with the diagnostic message “necessary dependency unavailable”.}(hj>hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h"not ok 1 test # TIMEOUT 30 secondsh]h"not ok 1 test # TIMEOUT 30 seconds}hjLsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h=The test "test" timed out, with diagnostic data "30 seconds".h]hEThe test “test” timed out, with diagnostic data “30 seconds”.}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(h ok 5 check return code # rcode=0h]h ok 5 check return code # rcode=0}hjhsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hRThe test "check return code" passed, with additional diagnostic data “rcode=0”h]hVThe test “check return code” passed, with additional diagnostic data “rcode=0”}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]test-case-result-linesah ]h"]test case result linesah$]h&]uh1hhhhhhhhKBubh)}(hhh](h)}(hDiagnostic linesh]hDiagnostic lines}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hX#If tests wish to output any further information, they should do so using "diagnostic lines". Diagnostic lines are optional, freeform text, and are often used to describe what is being tested and any intermediate results in more detail than the final result and diagnostic data line provides.h]hX'If tests wish to output any further information, they should do so using “diagnostic lines”. Diagnostic lines are optional, freeform text, and are often used to describe what is being tested and any intermediate results in more detail than the final result and diagnostic data line provides.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXDiagnostic lines are formatted as "# ", where the description can be any string. Diagnostic lines can be anywhere in the test output. As a rule, diagnostic lines regarding a test are directly before the test result line for that test.h]hXDiagnostic lines are formatted as “# ”, where the description can be any string. Diagnostic lines can be anywhere in the test output. As a rule, diagnostic lines regarding a test are directly before the test result line for that test.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hX3Note that most tools will treat unknown lines (see below) as diagnostic lines, even if they do not start with a "#": this is to capture any other useful kernel output which may help debug the test. It is nevertheless recommended that tests always prefix any diagnostic output they have with a "#" character.h]hX;Note that most tools will treat unknown lines (see below) as diagnostic lines, even if they do not start with a “#”: this is to capture any other useful kernel output which may help debug the test. It is nevertheless recommended that tests always prefix any diagnostic output they have with a “#” character.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]diagnostic-linesah ]h"]diagnostic linesah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Unknown linesh]h Unknown lines}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hThere may be lines within KTAP output that do not follow the format of one of the four formats for lines described above. This is allowed, however, they will not influence the status of the tests.h]hThere may be lines within KTAP output that do not follow the format of one of the four formats for lines described above. This is allowed, however, they will not influence the status of the tests.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXThis is an important difference from TAP. Kernel tests may print messages to the system console or a log file. Both of these destinations may contain messages either from unrelated kernel or userspace activity, or kernel messages from non-test code that is invoked by the test. The kernel code invoked by the test likely is not aware that a test is in progress and thus can not print the message as a diagnostic message.h]hXThis is an important difference from TAP. Kernel tests may print messages to the system console or a log file. Both of these destinations may contain messages either from unrelated kernel or userspace activity, or kernel messages from non-test code that is invoked by the test. The kernel code invoked by the test likely is not aware that a test is in progress and thus can not print the message as a diagnostic message.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h] unknown-linesah ]h"] unknown linesah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Nested testsh]h Nested tests}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hIn KTAP, tests can be nested. This is done by having a test include within its output an entire set of KTAP-formatted results. This can be used to categorize and group related tests, or to split out different results from the same test.h]hIn KTAP, tests can be nested. This is done by having a test include within its output an entire set of KTAP-formatted results. This can be used to categorize and group related tests, or to split out different results from the same test.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hThe "parent" test's result should consist of all of its subtests' results, starting with another KTAP version line and test plan, and end with the overall result. If one of the subtests fail, for example, the parent test should also fail.h]hThe “parent” test’s result should consist of all of its subtests’ results, starting with another KTAP version line and test plan, and end with the overall result. If one of the subtests fail, for example, the parent test should also fail.}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hAdditionally, all lines in a subtest should be indented. One level of indentation is two spaces: " ". The indentation should begin at the version line and should end before the parent test's result line.h]hAdditionally, all lines in a subtest should be indented. One level of indentation is two spaces: “ “. The indentation should begin at the version line and should end before the parent test’s result line.}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hw"Unknown lines" are not considered to be lines in a subtest and thus are allowed to be either indented or not indented.h]h{“Unknown lines” are not considered to be lines in a subtest and thus are allowed to be either indented or not indented.}(hj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(h.An example of a test with two nested subtests:h]h.An example of a test with two nested subtests:}(hjMhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hmKTAP version 1 1..1 KTAP version 1 1..2 ok 1 test_1 not ok 2 test_2 # example failed not ok 1 exampleh]hmKTAP version 1 1..1 KTAP version 1 1..2 ok 1 test_1 not ok 2 test_2 # example failed not ok 1 example}hj[sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h9An example format with multiple levels of nested testing:h]h9An example format with multiple levels of nested testing:}(hjihhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj)}(hKTAP version 1 1..2 KTAP version 1 1..2 KTAP version 1 1..2 not ok 1 test_1 ok 2 test_2 not ok 1 test_3 ok 2 test_4 # SKIP not ok 1 example_test_1 ok 2 example_test_2h]hKTAP version 1 1..2 KTAP version 1 1..2 KTAP version 1 1..2 not ok 1 test_1 ok 2 test_2 not ok 1 test_3 ok 2 test_4 # SKIP not ok 1 example_test_1 ok 2 example_test_2}hjwsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubeh}(h] nested-testsah ]h"] nested testsah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h&Major differences between TAP and KTAPh]h&Major differences between TAP and KTAP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubhtable)}(hhh]htgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthK2uh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthK uh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubhthead)}(hhh]hrow)}(hhh](hentry)}(hhh]h)}(hFeatureh]hFeature}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hTAPh]hTAP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hKTAPh]hKTAP}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhjubhtbody)}(hhh](j)}(hhh](j)}(hhh]h)}(h"yaml and json in diagnosic messageh]h"yaml and json in diagnosic message}(hj0hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj-ubah}(h]h ]h"]h$]h&]uh1jhj*ubj)}(hhh]h)}(hokh]hok}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjDubah}(h]h ]h"]h$]h&]uh1jhj*ubj)}(hhh]h)}(hnot recommendedh]hnot recommended}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj[ubah}(h]h ]h"]h$]h&]uh1jhj*ubeh}(h]h ]h"]h$]h&]uh1jhj'ubj)}(hhh](j)}(hhh]h)}(hTODO directiveh]hTODO directive}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj{ubah}(h]h ]h"]h$]h&]uh1jhjxubj)}(hhh]h)}(hokh]hok}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjxubj)}(hhh]h)}(hnot recognizedh]hnot recognized}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjxubeh}(h]h ]h"]h$]h&]uh1jhj'ubj)}(hhh](j)}(hhh]h)}(h0allows an arbitrary number of tests to be nestedh]h0allows an arbitrary number of tests to be nested}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hnoh]hno}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hyesh]hyes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhj'ubj)}(hhh](j)}(hhh]h)}(h2"Unknown lines" are in category of "Anything else"h]h:“Unknown lines” are in category of “Anything else”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hyesh]hyes}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj.ubah}(h]h ]h"]h$]h&]uh1jhjubj)}(hhh]h)}(hnoh]hno}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjEubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhj'ubj)}(hhh](j)}(hhh]h)}(h"Unknown lines" areh]h“Unknown lines” are}(hjhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjeubah}(h]h ]h"]h$]h&]uh1jhjbubj)}(hhh]h)}(h incorrecth]h incorrect}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj|ubah}(h]h ]h"]h$]h&]uh1jhjbubj)}(hhh]h)}(hallowedh]hallowed}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjbubeh}(h]h ]h"]h$]h&]uh1jhj'ubeh}(h]h ]h"]h$]h&]uh1j%hjubeh}(h]h ]h"]h$]h&]colsKuh1jhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubh)}(hThe TAP14 specification does permit nested tests, but instead of using another nested version line, uses a line of the form "Subtest: " where is the name of the parent test.h]hThe TAP14 specification does permit nested tests, but instead of using another nested version line, uses a line of the form “Subtest: ” where is the name of the parent test.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]&major-differences-between-tap-and-ktapah ]h"]&major differences between tap and ktapah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hExample KTAP outputh]hExample KTAP output}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubj)}(hXKTAP version 1 1..1 KTAP version 1 1..3 KTAP version 1 1..1 # test_1: initializing test_1 ok 1 test_1 ok 1 example_test_1 KTAP version 1 1..2 ok 1 test_1 # SKIP test_1 skipped ok 2 test_2 ok 2 example_test_2 KTAP version 1 1..3 ok 1 test_1 # test_2: FAIL not ok 2 test_2 ok 3 test_3 # SKIP test_3 skipped not ok 3 example_test_3 not ok 1 main_testh]hXKTAP version 1 1..1 KTAP version 1 1..3 KTAP version 1 1..1 # test_1: initializing test_1 ok 1 test_1 ok 1 example_test_1 KTAP version 1 1..2 ok 1 test_1 # SKIP test_1 skipped ok 2 test_2 ok 2 example_test_2 KTAP version 1 1..3 ok 1 test_1 # test_2: FAIL not ok 2 test_2 ok 3 test_3 # SKIP test_3 skipped not ok 3 example_test_3 not ok 1 main_test}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h,This output defines the following hierarchy:h]h,This output defines the following hierarchy:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h}A single test called "main_test", which fails, and has three subtests: - "example_test_1", which passes, and has one subtest:h]hA single test called “main_test”, which fails, and has three subtests: - “example_test_1”, which passes, and has one subtest:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh block_quote)}(h[- "test_1", which passes, and outputs the diagnostic message "test_1: initializing test_1" h]jH)}(hhh]jM)}(hY"test_1", which passes, and outputs the diagnostic message "test_1: initializing test_1" h]h)}(hX"test_1", which passes, and outputs the diagnostic message "test_1: initializing test_1"h]h`“test_1”, which passes, and outputs the diagnostic message “test_1: initializing test_1”}(hj!hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jLhjubah}(h]h ]h"]h$]h&]jjuh1jGhhhMhjubah}(h]h ]h"]h$]h&]uh1jhhhMhjhhubjH)}(hhh](jM)}(h"example_test_2", which passes, and has two subtests: - "test_1", which is skipped, with the explanation "test_1 skipped" - "test_2", which passes h](h)}(h5"example_test_2", which passes, and has two subtests:h]h9“example_test_2”, which passes, and has two subtests:}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjDubj)}(h]- "test_1", which is skipped, with the explanation "test_1 skipped" - "test_2", which passes h]jH)}(hhh](jM)}(hA"test_1", which is skipped, with the explanation "test_1 skipped"h]h)}(hj_h]hI“test_1”, which is skipped, with the explanation “test_1 skipped”}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj]ubah}(h]h ]h"]h$]h&]uh1jLhjZubjM)}(h"test_2", which passes h]h)}(h"test_2", which passesh]h“test_2”, which passes}(hjxhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjtubah}(h]h ]h"]h$]h&]uh1jLhjZubeh}(h]h ]h"]h$]h&]jjuh1jGhhhMhjVubah}(h]h ]h"]h$]h&]uh1jhhhMhjDubeh}(h]h ]h"]h$]h&]uh1jLhjAhhhhhNubjM)}(h"example_test_3", which fails, and has three subtests - "test_1", which passes - "test_2", which outputs the diagnostic line "test_2: FAIL", and fails. - "test_3", which is skipped with the explanation "test_3 skipped" h](h)}(h5"example_test_3", which fails, and has three subtestsh]h9“example_test_3”, which fails, and has three subtests}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hjubj)}(h- "test_1", which passes - "test_2", which outputs the diagnostic line "test_2: FAIL", and fails. - "test_3", which is skipped with the explanation "test_3 skipped" h]jH)}(hhh](jM)}(h"test_1", which passesh]h)}(hjh]h“test_1”, which passes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM"hjubah}(h]h ]h"]h$]h&]uh1jLhjubjM)}(hF"test_2", which outputs the diagnostic line "test_2: FAIL", and fails.h]h)}(hjh]hN“test_2”, which outputs the diagnostic line “test_2: FAIL”, and fails.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM#hjubah}(h]h ]h"]h$]h&]uh1jLhjubjM)}(hA"test_3", which is skipped with the explanation "test_3 skipped" h]h)}(h@"test_3", which is skipped with the explanation "test_3 skipped"h]hH“test_3”, which is skipped with the explanation “test_3 skipped”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM$hjubah}(h]h ]h"]h$]h&]uh1jLhjubeh}(h]h ]h"]h$]h&]jjuh1jGhhhM"hjubah}(h]h ]h"]h$]h&]uh1jhhhM"hjubeh}(h]h ]h"]h$]h&]uh1jLhjAhhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jGhhhMhjhhubh)}(hXNote that the individual subtests with the same names do not conflict, as they are found in different parent tests. This output also exhibits some sensible rules for "bubbling up" test results: a test fails if any of its subtests fail. Skipped tests do not affect the result of the parent test (though it often makes sense for a test to be marked skipped if _all_ of its subtests have been skipped).h]hXNote that the individual subtests with the same names do not conflict, as they are found in different parent tests. This output also exhibits some sensible rules for “bubbling up” test results: a test fails if any of its subtests fail. Skipped tests do not affect the result of the parent test (though it often makes sense for a test to be marked skipped if _all_ of its subtests have been skipped).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM&hjhhubeh}(h]example-ktap-outputah ]h"]example ktap outputah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h See also:h]h See also:}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj+hhhhhM.ubjH)}(hhh](jM)}(hQThe TAP specification: https://testanything.org/tap-version-13-specification.htmlh]h)}(hQThe TAP specification: https://testanything.org/tap-version-13-specification.htmlh](hThe TAP specification: }(hjChhhNhNubh)}(h:https://testanything.org/tap-version-13-specification.htmlh]h:https://testanything.org/tap-version-13-specification.html}(hjKhhhNhNubah}(h]h ]h"]h$]h&]refurijMuh1hhjCubeh}(h]h ]h"]h$]h&]uh1hhhhM0hj?ubah}(h]h ]h"]h$]h&]uh1jLhj<hhhhhNubjM)}(hThe (stagnant) TAP version 14 specification: https://github.com/TestAnything/Specification/blob/tap-14-specification/specification.mdh]h)}(hThe (stagnant) TAP version 14 specification: https://github.com/TestAnything/Specification/blob/tap-14-specification/specification.mdh](h-The (stagnant) TAP version 14 specification: }(hjjhhhNhNubh)}(hXhttps://github.com/TestAnything/Specification/blob/tap-14-specification/specification.mdh]hXhttps://github.com/TestAnything/Specification/blob/tap-14-specification/specification.md}(hjrhhhNhNubah}(h]h ]h"]h$]h&]refurijtuh1hhjjubeh}(h]h ]h"]h$]h&]uh1hhhhM2hjfubah}(h]h ]h"]h$]h&]uh1jLhj<hhhhhNubjM)}(hBThe kselftest documentation: Documentation/dev-tools/kselftest.rsth]h)}(hBThe kselftest documentation: Documentation/dev-tools/kselftest.rsth]hBThe kselftest documentation: Documentation/dev-tools/kselftest.rst}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hjubah}(h]h ]h"]h$]h&]uh1jLhj<hhhhhNubjM)}(h@The KUnit documentation: Documentation/dev-tools/kunit/index.rsth]h)}(h@The KUnit documentation: Documentation/dev-tools/kunit/index.rsth]h@The KUnit documentation: Documentation/dev-tools/kunit/index.rst}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM6hjubah}(h]h ]h"]h$]h&]uh1jLhj<hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1jGhhhM0hj+hhubeh}(h]see-alsoah ]h"] see also:ah$]h&]uh1hhhhhhhhM.ubeh}(h]0the-kernel-test-anything-protocol-ktap-version-1ah ]h"]3the kernel test anything protocol (ktap), version 1ah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksjfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjhhjyjvjjjjjjjjjjjjj(j%jju nametypes}(jhjyjjjjjjj(juh}(jhhhjvj+jj|jjjjjjjjjjj%jjj+u footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.