diff mbox series

[v3] selftests:Fix printf format string in kselftest_harness.h

Message ID 20240724062624.5157-1-zhujun2@cmss.chinamobile.com (mailing list archive)
State New
Headers show
Series [v3] selftests:Fix printf format string in kselftest_harness.h | expand

Commit Message

Zhu Jun July 24, 2024, 6:26 a.m. UTC
'%u' in format string requires 'unsigned int' in __wait_for_test()
but the argument type is 'signed int' that this problem was discovered
by reading code.use macro WTERMSIG like those above usage to
fix the wrong format specifier.

Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
Changes 
v1->v2:
	modify commit info add how to find the problem in the log
v2->v3:
	Seems this can use macro WTERMSIG like those above usage, rather than
	changing the print format.

 tools/testing/selftests/kselftest_harness.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Shuah Khan July 24, 2024, 8:32 p.m. UTC | #1
On 7/24/24 00:26, Zhu Jun wrote:
> '%u' in format string requires 'unsigned int' in __wait_for_test()
> but the argument type is 'signed int' that this problem was discovered
> by reading code.use macro WTERMSIG like those above usage to
> fix the wrong format specifier.
> 

Now the commit summary doesn't match the change you are making.
Also WTERMSIG() is incorrect for this conditional code path.
See comments below in the code path.

I would leave the v2 code intact. How are you testing this change?
Please include the details in the change log.

Reformat the message to too imperative mood.


Check Documentation/process/submitting-patches.rst for details
on how to write commit messages.

> Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
> ---
> Changes
> v1->v2:
> 	modify commit info add how to find the problem in the log
> v2->v3:
> 	Seems this can use macro WTERMSIG like those above usage, rather than
> 	changing the print format.
> 
>   tools/testing/selftests/kselftest_harness.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
> index dbbbcc6c04ee..f41f4435e9a4 100644
> --- a/tools/testing/selftests/kselftest_harness.h
> +++ b/tools/testing/selftests/kselftest_harness.h
> @@ -1086,7 +1086,7 @@ void __wait_for_test(struct __test_metadata *t)
>   		fprintf(TH_LOG_STREAM,
>   			"# %s: Test ended in some other way [%d]\n",>   			t->name,
> -			status);
> +			WTERMSIG(status));

WTERMSIG() is not the correct call to use since it is not a
WIFSIGNALED conditional.

thanks,
-- Shuah
diff mbox series

Patch

diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h
index dbbbcc6c04ee..f41f4435e9a4 100644
--- a/tools/testing/selftests/kselftest_harness.h
+++ b/tools/testing/selftests/kselftest_harness.h
@@ -1086,7 +1086,7 @@  void __wait_for_test(struct __test_metadata *t)
 		fprintf(TH_LOG_STREAM,
 			"# %s: Test ended in some other way [%d]\n",
 			t->name,
-			status);
+			WTERMSIG(status));
 	}
 }