[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8859fafe-2df1-42ba-b9de-2ba1c0e75d14@collabora.com>
Date: Tue, 16 Apr 2024 19:11:39 +0500
From: Muhammad Usama Anjum <usama.anjum@...labora.com>
To: Jakub Kicinski <kuba@...nel.org>, keescook@...omium.org,
shuah@...nel.org, Nathan Chancellor <nathan@...nel.org>,
"David S. Miller" <davem@...emloft.net>
Cc: Muhammad Usama Anjum <usama.anjum@...labora.com>, netdev@...r.kernel.org,
edumazet@...gle.com, pabeni@...hat.com, linux-kselftest@...r.kernel.org,
mic@...ikod.net, linux-security-module@...r.kernel.org,
jakub@...udflare.com, davem@...emloft.net
Subject: Re: [PATCH v4 10/12] selftests: kselftest_harness: let PASS / FAIL
provide diagnostic
On 2/29/24 5:59 AM, Jakub Kicinski wrote:
> Switch to printing KTAP line for PASS / FAIL with ksft_test_result_code(),
> this gives us the ability to report diagnostic messages.
>
> Reviewed-by: Kees Cook <keescook@...omium.org>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> tools/testing/selftests/kselftest_harness.h | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
> index 5b0592e4b7a4..b643a577f9e1 100644
> --- a/tools/testing/selftests/kselftest_harness.h
> +++ b/tools/testing/selftests/kselftest_harness.h
> @@ -1143,14 +1143,13 @@ void __run_test(struct __fixture_metadata *f,
>
> if (t->results->reason[0])
> diagnostic = t->results->reason;
> + else if (t->exit_code == KSFT_PASS || t->exit_code == KSFT_FAIL)
> + diagnostic = NULL;
> else
> diagnostic = "unknown";
>
> - if (t->exit_code == KSFT_SKIP)
> - ksft_test_result_code(t->exit_code, test_name,
> - "%s", diagnostic);
> - else
> - ksft_test_result(__test_passed(t), "%s\n", test_name);
> + ksft_test_result_code(t->exit_code, test_name,
> + diagnostic ? "%s" : "", diagnostic);
We are getting the following annoying warning while using clang:
./../kselftest_harness.h:1207:30: warning: format string is empty
[-Wformat-zero-length]
1207 | diagnostic ? "%s" : "", diagnostic);
| ^~
1 warning generated.
I've tried to look for solution. In my opinion, the best solution would be
to just revert this patch. Any thoughts?
> }
>
> static int test_harness_run(int argc, char **argv)
--
BR,
Muhammad Usama Anjum
Powered by blists - more mailing lists