Skip to content

Commit

Permalink
selftests: kselftest_harness: use KSFT_* exit codes
Browse files Browse the repository at this point in the history
Now that we no longer need low exit codes to communicate
assertion steps - use normal KSFT exit codes.

Acked-by: Kees Cook <keescook@chromium.org>
Tested-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Mar 1, 2024
1 parent 0710a1a commit a724707
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tools/testing/selftests/kselftest_harness.h
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,7 @@ void __wait_for_test(struct __test_metadata *t)
fprintf(TH_LOG_STREAM,
"# %s: Test terminated by timeout\n", t->name);
} else if (WIFEXITED(status)) {
if (WEXITSTATUS(status) == 255) {
if (WEXITSTATUS(status) == KSFT_SKIP) {
/* SKIP */
t->passed = 1;
t->skip = 1;
Expand All @@ -949,7 +949,7 @@ void __wait_for_test(struct __test_metadata *t)
} else {
switch (WEXITSTATUS(status)) {
/* Success */
case 0:
case KSFT_PASS:
t->passed = 1;
break;
/* Failure */
Expand Down Expand Up @@ -1128,11 +1128,10 @@ void __run_test(struct __fixture_metadata *f,
setpgrp();
t->fn(t, variant);
if (t->skip)
_exit(255);
/* Pass is exit 0 */
_exit(KSFT_SKIP);
if (t->passed)
_exit(0);
_exit(1);
_exit(KSFT_PASS);
_exit(KSFT_FAIL);
} else {
__wait_for_test(t);
}
Expand Down

0 comments on commit a724707

Please sign in to comment.