2024-04-09 23:09:30

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [PATCH] selftests: kselftest_harness: Print empty string, not empty fmt on PASS/FAIL

On Tue, 9 Apr 2024 15:42:56 -0700 Sean Christopherson wrote:
> - ksft_test_result_code(t->exit_code, test_name,
> - diagnostic ? "%s" : "", diagnostic);
> + ksft_test_result_code(t->exit_code, test_name, "%s", diagnostic);

Have you tested that to make sure it doesn't change the output?

. warning: ^^ leading question ;)


2024-04-09 23:55:25

by Kees Cook

[permalink] [raw]
Subject: Re: [PATCH] selftests: kselftest_harness: Print empty string, not empty fmt on PASS/FAIL

On Tue, Apr 09, 2024 at 04:09:20PM -0700, Jakub Kicinski wrote:
> On Tue, 9 Apr 2024 15:42:56 -0700 Sean Christopherson wrote:
> > - ksft_test_result_code(t->exit_code, test_name,
> > - diagnostic ? "%s" : "", diagnostic);
> > + ksft_test_result_code(t->exit_code, test_name, "%s", diagnostic);
>
> Have you tested that to make sure it doesn't change the output?
>
> .. warning: ^^ leading question ;)

Probably should be just this, without changing the NULL init?

ksft_test_result_code(t->exit_code, test_name, "%s",
diagnostic ?: "");

--
Kees Cook

2024-04-10 00:14:32

by Sean Christopherson

[permalink] [raw]
Subject: Re: [PATCH] selftests: kselftest_harness: Print empty string, not empty fmt on PASS/FAIL

On Tue, Apr 09, 2024, Jakub Kicinski wrote:
> On Tue, 9 Apr 2024 15:42:56 -0700 Sean Christopherson wrote:
> > - ksft_test_result_code(t->exit_code, test_name,
> > - diagnostic ? "%s" : "", diagnostic);
> > + ksft_test_result_code(t->exit_code, test_name, "%s", diagnostic);
>
> Have you tested that to make sure it doesn't change the output?
>
> .. warning: ^^ leading question ;)

Heh, I was *this* close to adding a blurb saying this was probably only compile
tested.