Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: harness: Validate intermixing of kselftest and harness functionality

Make sure that calling ksft_test_result_*() functions from harness
tests work as expected.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://lore.kernel.org/r/20260302-kselftest-harness-v2-5-3143aa41d989@linutronix.de
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Thomas Weißschuh and committed by
Shuah Khan
132618c5 a0877a35

+46 -9
+20
tools/testing/selftests/kselftest_harness/harness-selftest.c
··· 138 138 exit(KSFT_SKIP); 139 139 } 140 140 141 + TEST(test_result_pass) { 142 + ksft_test_result_pass(""); 143 + } 144 + 145 + TEST(test_result_xpass) { 146 + ksft_test_result_xpass(""); 147 + } 148 + 149 + TEST(test_result_fail) { 150 + ksft_test_result_fail(""); 151 + } 152 + 153 + TEST(test_result_xfail) { 154 + ksft_test_result_xfail(""); 155 + } 156 + 157 + TEST(test_result_skip) { 158 + ksft_test_result_skip(""); 159 + } 160 + 141 161 int main(int argc, char **argv) 142 162 { 143 163 /*
+26 -9
tools/testing/selftests/kselftest_harness/harness-selftest.expected
··· 1 1 TAP version 13 2 - 1..14 3 - # Starting 14 tests from 4 test cases. 2 + 1..19 3 + # Starting 19 tests from 4 test cases. 4 4 # RUN global.standalone_pass ... 5 5 # harness-selftest.c:19:standalone_pass:before 6 6 # harness-selftest.c:23:standalone_pass:after ··· 40 40 # RUN global.exit_skip ... 41 41 # OK global.exit_skip 42 42 ok 9 global.exit_skip # SKIP unknown 43 + # RUN global.test_result_pass ... 44 + # OK global.test_result_pass 45 + ok 10 global.test_result_pass 46 + # RUN global.test_result_xpass ... 47 + # OK global.test_result_xpass 48 + ok 11 global.test_result_xpass 49 + # RUN global.test_result_fail ... 50 + not ok 1 # Illegal usage of low-level ksft APIs in harness test 51 + # test_result_fail: Test failed 52 + # FAIL global.test_result_fail 53 + not ok 12 global.test_result_fail 54 + # RUN global.test_result_xfail ... 55 + # OK global.test_result_xfail 56 + ok 13 global.test_result_xfail 57 + # RUN global.test_result_skip ... 58 + # OK global.test_result_skip 59 + ok 14 global.test_result_skip 43 60 # RUN fixture.pass ... 44 61 # harness-selftest.c:53:pass:setup 45 62 # harness-selftest.c:62:pass:before ··· 65 48 # harness-selftest.c:66:pass:after 66 49 # harness-selftest.c:58:pass:teardown same-process=1 67 50 # OK fixture.pass 68 - ok 10 fixture.pass 51 + ok 15 fixture.pass 69 52 # RUN fixture.fail ... 70 53 # harness-selftest.c:53:fail:setup 71 54 # harness-selftest.c:70:fail:before ··· 73 56 # harness-selftest.c:58:fail:teardown same-process=1 74 57 # fail: Test terminated by assertion 75 58 # FAIL fixture.fail 76 - not ok 11 fixture.fail 59 + not ok 16 fixture.fail 77 60 # RUN fixture.timeout ... 78 61 # harness-selftest.c:53:timeout:setup 79 62 # harness-selftest.c:77:timeout:before 80 63 # timeout: Test terminated by timeout 81 64 # FAIL fixture.timeout 82 - not ok 12 fixture.timeout 65 + not ok 17 fixture.timeout 83 66 # RUN fixture_parent.pass ... 84 67 # harness-selftest.c:87:pass:setup 85 68 # harness-selftest.c:96:pass:before 86 69 # harness-selftest.c:98:pass:after 87 70 # harness-selftest.c:92:pass:teardown same-process=0 88 71 # OK fixture_parent.pass 89 - ok 13 fixture_parent.pass 72 + ok 18 fixture_parent.pass 90 73 # RUN fixture_setup_failure.pass ... 91 74 # harness-selftest.c:106:pass:setup 92 75 # harness-selftest.c:108:pass:Expected 0 (0) == 1 (1) 93 76 # pass: Test terminated by assertion 94 77 # FAIL fixture_setup_failure.pass 95 - not ok 14 fixture_setup_failure.pass 96 - # FAILED: 8 / 14 tests passed. 78 + not ok 19 fixture_setup_failure.pass 79 + # FAILED: 12 / 19 tests passed. 97 80 # 1 skipped test(s) detected. Consider enabling relevant config options to improve coverage. 98 - # Totals: pass:5 fail:6 xfail:1 xpass:1 skip:1 error:0 81 + # Totals: pass:9 fail:7 xfail:1 xpass:1 skip:1 error:0