selftests: kselftest: add ksft_test_result_code(), handling all exit codes
authorJakub Kicinski <kuba@kernel.org>
Thu, 29 Feb 2024 00:59:14 +0000 (16:59 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 Mar 2024 10:30:28 +0000 (10:30 +0000)
commitfa1a53d83674b3aa089b8661ee9f884c024f6e95
treefb69dd3ae0469ecb5155b908d16527bff8f0e6bd
parent796a344fa4315f9c1f2258de14c1d20cbbef79a8
selftests: kselftest: add ksft_test_result_code(), handling all exit codes

For generic test harness code it's more useful to deal with exit
codes directly, rather than having to switch on them and call
the right ksft_test_result_*() helper. Add such function to kselftest.h.

Note that "directive" and "diagnostic" are what ktap docs call
those parts of the message.

Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/kselftest.h
tools/testing/selftests/kselftest_harness.h