kselftest: Add a ksft_perror() helper
authorMark Brown <broonie@kernel.org>
Thu, 28 Sep 2023 14:38:11 +0000 (16:38 +0200)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 5 Oct 2023 20:49:58 +0000 (14:49 -0600)
commit907f33028871fa7c9a3db1efd467b78ef82cce20
tree6a57057789c667a7724ecfc3621840825ce0329e
parent1c71a121c7ff41bf6605b2604408d109eab047ae
kselftest: Add a ksft_perror() helper

The standard library perror() function provides a convenient way to print
an error message based on the current errno but this doesn't play nicely
with KTAP output. Provide a helper which does an equivalent thing in a KTAP
compatible format.

nolibc doesn't have a strerror() and adding the table of strings required
doesn't seem like a good fit for what it's trying to do so when we're using
that only print the errno.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/kselftest.h