diff options
author | Jakub Kicinski <kuba@kernel.org> | 2021-11-25 01:39:16 +0300 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2021-12-11 02:46:01 +0300 |
commit | 3abedf4646fdc0036fcb8ebbc3b600667167fafe (patch) | |
tree | fa08b4d3208d94179076273c2ffa0a09aca78130 /tools/testing/selftests/kselftest_harness.h | |
parent | e5992f373c6eed6d09e5858e9623df1259b3ce30 (diff) | |
download | linux-3abedf4646fdc0036fcb8ebbc3b600667167fafe.tar.xz |
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: 369130b63178 ("selftests: Enhance kselftest_harness.h to print which assert failed")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/kselftest_harness.h')
-rw-r--r-- | tools/testing/selftests/kselftest_harness.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h index ae0f0f33b2a6..79a182cfa43a 100644 --- a/tools/testing/selftests/kselftest_harness.h +++ b/tools/testing/selftests/kselftest_harness.h @@ -969,7 +969,7 @@ void __run_test(struct __fixture_metadata *f, t->passed = 1; t->skip = 0; t->trigger = 0; - t->step = 0; + t->step = 1; t->no_print = 0; memset(t->results->reason, 0, sizeof(t->results->reason)); |