Skip to content

Commit 3abedf4

Browse files
kuba-mooshuahkh
authored andcommitted
selftests: harness: avoid false negatives if test has no ASSERTs
Test can fail either immediately when ASSERT() failed or at the end if one or more EXPECT() was not met. The exact return code is decided based on the number of successful ASSERT()s. If test has no ASSERT()s, however, the return code will be 0, as if the test did not fail. Start counting ASSERT()s from 1. Fixes: 369130b ("selftests: Enhance kselftest_harness.h to print which assert failed") Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent e5992f3 commit 3abedf4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/testing/selftests/kselftest_harness.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ void __run_test(struct __fixture_metadata *f,
969969
t->passed = 1;
970970
t->skip = 0;
971971
t->trigger = 0;
972-
t->step = 0;
972+
t->step = 1;
973973
t->no_print = 0;
974974
memset(t->results->reason, 0, sizeof(t->results->reason));
975975

0 commit comments

Comments
 (0)