* [PATCH] selftests:modify the incorrect print format
@ 2023-10-16 2:50 zhujun2
2023-10-16 19:16 ` Shuah Khan
0 siblings, 1 reply; 7+ messages in thread
From: zhujun2 @ 2023-10-16 2:50 UTC (permalink / raw)
To: shuah
Cc: nathan, ndesaulniers, trix, linux-kselftest, linux-kernel, llvm, zhujun2
printf %d in format string requires 'int' but the argument type is 'unsigned int'
Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
---
tools/testing/selftests/kselftest.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 529d29a35..bec2fae58 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -129,7 +129,7 @@ static inline void ksft_print_header(void)
static inline void ksft_set_plan(unsigned int plan)
{
ksft_plan = plan;
- printf("1..%d\n", ksft_plan);
+ printf("1..%u\n", ksft_plan);
}
static inline void ksft_print_cnts(void)
@@ -137,7 +137,7 @@ static inline void ksft_print_cnts(void)
if (ksft_plan != ksft_test_num())
printf("# Planned tests != run tests (%u != %u)\n",
ksft_plan, ksft_test_num());
- printf("# Totals: pass:%d fail:%d xfail:%d xpass:%d skip:%d error:%d\n",
+ printf("# Totals: pass:%u fail:%u xfail:%u xpass:%u skip:%u error:%u\n",
ksft_cnt.ksft_pass, ksft_cnt.ksft_fail,
ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass,
ksft_cnt.ksft_xskip, ksft_cnt.ksft_error);
@@ -163,7 +163,7 @@ static inline void ksft_test_result_pass(const char *msg, ...)
ksft_cnt.ksft_pass++;
va_start(args, msg);
- printf("ok %d ", ksft_test_num());
+ printf("ok %u ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -177,7 +177,7 @@ static inline void ksft_test_result_fail(const char *msg, ...)
ksft_cnt.ksft_fail++;
va_start(args, msg);
- printf("not ok %d ", ksft_test_num());
+ printf("not ok %u ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -203,7 +203,7 @@ static inline void ksft_test_result_xfail(const char *msg, ...)
ksft_cnt.ksft_xfail++;
va_start(args, msg);
- printf("ok %d # XFAIL ", ksft_test_num());
+ printf("ok %u # XFAIL ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -217,7 +217,7 @@ static inline void ksft_test_result_skip(const char *msg, ...)
ksft_cnt.ksft_xskip++;
va_start(args, msg);
- printf("ok %d # SKIP ", ksft_test_num());
+ printf("ok %u # SKIP ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -232,7 +232,7 @@ static inline void ksft_test_result_error(const char *msg, ...)
ksft_cnt.ksft_error++;
va_start(args, msg);
- printf("not ok %d # error ", ksft_test_num());
+ printf("not ok %u # error ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] selftests:modify the incorrect print format
2023-10-16 2:50 [PATCH] selftests:modify the incorrect print format zhujun2
@ 2023-10-16 19:16 ` Shuah Khan
0 siblings, 0 replies; 7+ messages in thread
From: Shuah Khan @ 2023-10-16 19:16 UTC (permalink / raw)
To: zhujun2, shuah
Cc: nathan, ndesaulniers, trix, linux-kselftest, linux-kernel, llvm,
Shuah Khan
On 10/15/23 20:50, zhujun2 wrote:
> printf %d in format string requires 'int' but the argument type is 'unsigned int'
This line to long. Character limit is < 75/line.
How did you find this problem? Please add the details to
the commit log.
>
> Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
> ---
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] selftests:modify the incorrect print format
2023-10-18 19:09 ` Shuah Khan
@ 2023-10-19 1:16 ` zhujun2
0 siblings, 0 replies; 7+ messages in thread
From: zhujun2 @ 2023-10-19 1:16 UTC (permalink / raw)
To: skhan
Cc: linux-kernel, linux-kselftest, llvm, nathan, ndesaulniers, shuah,
trix, zhujun2
when the argument type is 'unsigned int',printf '%u'
in format string that this problem was discovered
by code reading
Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
---
tools/testing/selftests/kselftest.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 529d29a35..bec2fae58 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -129,7 +129,7 @@ static inline void ksft_print_header(void)
static inline void ksft_set_plan(unsigned int plan)
{
ksft_plan = plan;
- printf("1..%d\n", ksft_plan);
+ printf("1..%u\n", ksft_plan);
}
static inline void ksft_print_cnts(void)
@@ -137,7 +137,7 @@ static inline void ksft_print_cnts(void)
if (ksft_plan != ksft_test_num())
printf("# Planned tests != run tests (%u != %u)\n",
ksft_plan, ksft_test_num());
- printf("# Totals: pass:%d fail:%d xfail:%d xpass:%d skip:%d error:%d\n",
+ printf("# Totals: pass:%u fail:%u xfail:%u xpass:%u skip:%u error:%u\n",
ksft_cnt.ksft_pass, ksft_cnt.ksft_fail,
ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass,
ksft_cnt.ksft_xskip, ksft_cnt.ksft_error);
@@ -163,7 +163,7 @@ static inline void ksft_test_result_pass(const char *msg, ...)
ksft_cnt.ksft_pass++;
va_start(args, msg);
- printf("ok %d ", ksft_test_num());
+ printf("ok %u ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -177,7 +177,7 @@ static inline void ksft_test_result_fail(const char *msg, ...)
ksft_cnt.ksft_fail++;
va_start(args, msg);
- printf("not ok %d ", ksft_test_num());
+ printf("not ok %u ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -203,7 +203,7 @@ static inline void ksft_test_result_xfail(const char *msg, ...)
ksft_cnt.ksft_xfail++;
va_start(args, msg);
- printf("ok %d # XFAIL ", ksft_test_num());
+ printf("ok %u # XFAIL ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -217,7 +217,7 @@ static inline void ksft_test_result_skip(const char *msg, ...)
ksft_cnt.ksft_xskip++;
va_start(args, msg);
- printf("ok %d # SKIP ", ksft_test_num());
+ printf("ok %u # SKIP ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -232,7 +232,7 @@ static inline void ksft_test_result_error(const char *msg, ...)
ksft_cnt.ksft_error++;
va_start(args, msg);
- printf("not ok %d # error ", ksft_test_num());
+ printf("not ok %u # error ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] selftests:modify the incorrect print format
2023-10-17 15:54 ` Shuah Khan
@ 2023-10-18 19:09 ` Shuah Khan
2023-10-19 1:16 ` zhujun2
0 siblings, 1 reply; 7+ messages in thread
From: Shuah Khan @ 2023-10-18 19:09 UTC (permalink / raw)
To: zhujun2, shuah
Cc: nathan, ndesaulniers, trix, linux-kselftest, linux-kernel, llvm,
Shuah Khan
On 10/17/23 09:54, Shuah Khan wrote:
> On 10/16/23 20:08, zhujun2 wrote:
>> when the argument type is 'unsigned int',printf '%u'
>> in format string
>>
>
> Please add how you found the problem to the commit log.
>
>> Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
>
> thanks,
> -- Shuah
>
Applied to linux-kselftest next for Linux 6.7-rc1.
Updated the commit log with details on how the problem was found.
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] selftests:modify the incorrect print format
2023-10-17 2:08 zhujun2
@ 2023-10-17 15:54 ` Shuah Khan
2023-10-18 19:09 ` Shuah Khan
0 siblings, 1 reply; 7+ messages in thread
From: Shuah Khan @ 2023-10-17 15:54 UTC (permalink / raw)
To: zhujun2, shuah
Cc: nathan, ndesaulniers, trix, linux-kselftest, linux-kernel, llvm,
Shuah Khan
On 10/16/23 20:08, zhujun2 wrote:
> when the argument type is 'unsigned int',printf '%u'
> in format string
>
Please add how you found the problem to the commit log.
> Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] selftests:modify the incorrect print format
@ 2023-10-17 2:08 zhujun2
2023-10-17 15:54 ` Shuah Khan
0 siblings, 1 reply; 7+ messages in thread
From: zhujun2 @ 2023-10-17 2:08 UTC (permalink / raw)
To: shuah
Cc: nathan, ndesaulniers, trix, linux-kselftest, linux-kernel, llvm, zhujun2
when the argument type is 'unsigned int',printf '%u'
in format string
Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
---
tools/testing/selftests/kselftest.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 529d29a35..bec2fae58 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -129,7 +129,7 @@ static inline void ksft_print_header(void)
static inline void ksft_set_plan(unsigned int plan)
{
ksft_plan = plan;
- printf("1..%d\n", ksft_plan);
+ printf("1..%u\n", ksft_plan);
}
static inline void ksft_print_cnts(void)
@@ -137,7 +137,7 @@ static inline void ksft_print_cnts(void)
if (ksft_plan != ksft_test_num())
printf("# Planned tests != run tests (%u != %u)\n",
ksft_plan, ksft_test_num());
- printf("# Totals: pass:%d fail:%d xfail:%d xpass:%d skip:%d error:%d\n",
+ printf("# Totals: pass:%u fail:%u xfail:%u xpass:%u skip:%u error:%u\n",
ksft_cnt.ksft_pass, ksft_cnt.ksft_fail,
ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass,
ksft_cnt.ksft_xskip, ksft_cnt.ksft_error);
@@ -163,7 +163,7 @@ static inline void ksft_test_result_pass(const char *msg, ...)
ksft_cnt.ksft_pass++;
va_start(args, msg);
- printf("ok %d ", ksft_test_num());
+ printf("ok %u ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -177,7 +177,7 @@ static inline void ksft_test_result_fail(const char *msg, ...)
ksft_cnt.ksft_fail++;
va_start(args, msg);
- printf("not ok %d ", ksft_test_num());
+ printf("not ok %u ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -203,7 +203,7 @@ static inline void ksft_test_result_xfail(const char *msg, ...)
ksft_cnt.ksft_xfail++;
va_start(args, msg);
- printf("ok %d # XFAIL ", ksft_test_num());
+ printf("ok %u # XFAIL ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -217,7 +217,7 @@ static inline void ksft_test_result_skip(const char *msg, ...)
ksft_cnt.ksft_xskip++;
va_start(args, msg);
- printf("ok %d # SKIP ", ksft_test_num());
+ printf("ok %u # SKIP ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -232,7 +232,7 @@ static inline void ksft_test_result_error(const char *msg, ...)
ksft_cnt.ksft_error++;
va_start(args, msg);
- printf("not ok %d # error ", ksft_test_num());
+ printf("not ok %u # error ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] selftests:modify the incorrect print format
@ 2023-10-09 3:16 zhujun2
0 siblings, 0 replies; 7+ messages in thread
From: zhujun2 @ 2023-10-09 3:16 UTC (permalink / raw)
To: shuah; +Cc: nathan, ndesaulniers, trix, linux-kernel, zhujun2
printf %d in format string requires 'int' but the argument type is 'unsigned int'
Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
---
tools/testing/selftests/kselftest.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h
index 529d29a35..bec2fae58 100644
--- a/tools/testing/selftests/kselftest.h
+++ b/tools/testing/selftests/kselftest.h
@@ -129,7 +129,7 @@ static inline void ksft_print_header(void)
static inline void ksft_set_plan(unsigned int plan)
{
ksft_plan = plan;
- printf("1..%d\n", ksft_plan);
+ printf("1..%u\n", ksft_plan);
}
static inline void ksft_print_cnts(void)
@@ -137,7 +137,7 @@ static inline void ksft_print_cnts(void)
if (ksft_plan != ksft_test_num())
printf("# Planned tests != run tests (%u != %u)\n",
ksft_plan, ksft_test_num());
- printf("# Totals: pass:%d fail:%d xfail:%d xpass:%d skip:%d error:%d\n",
+ printf("# Totals: pass:%u fail:%u xfail:%u xpass:%u skip:%u error:%u\n",
ksft_cnt.ksft_pass, ksft_cnt.ksft_fail,
ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass,
ksft_cnt.ksft_xskip, ksft_cnt.ksft_error);
@@ -163,7 +163,7 @@ static inline void ksft_test_result_pass(const char *msg, ...)
ksft_cnt.ksft_pass++;
va_start(args, msg);
- printf("ok %d ", ksft_test_num());
+ printf("ok %u ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -177,7 +177,7 @@ static inline void ksft_test_result_fail(const char *msg, ...)
ksft_cnt.ksft_fail++;
va_start(args, msg);
- printf("not ok %d ", ksft_test_num());
+ printf("not ok %u ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -203,7 +203,7 @@ static inline void ksft_test_result_xfail(const char *msg, ...)
ksft_cnt.ksft_xfail++;
va_start(args, msg);
- printf("ok %d # XFAIL ", ksft_test_num());
+ printf("ok %u # XFAIL ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -217,7 +217,7 @@ static inline void ksft_test_result_skip(const char *msg, ...)
ksft_cnt.ksft_xskip++;
va_start(args, msg);
- printf("ok %d # SKIP ", ksft_test_num());
+ printf("ok %u # SKIP ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
@@ -232,7 +232,7 @@ static inline void ksft_test_result_error(const char *msg, ...)
ksft_cnt.ksft_error++;
va_start(args, msg);
- printf("not ok %d # error ", ksft_test_num());
+ printf("not ok %u # error ", ksft_test_num());
errno = saved_errno;
vprintf(msg, args);
va_end(args);
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-10-19 1:17 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-16 2:50 [PATCH] selftests:modify the incorrect print format zhujun2
2023-10-16 19:16 ` Shuah Khan
-- strict thread matches above, loose matches on Subject: below --
2023-10-17 2:08 zhujun2
2023-10-17 15:54 ` Shuah Khan
2023-10-18 19:09 ` Shuah Khan
2023-10-19 1:16 ` zhujun2
2023-10-09 3:16 zhujun2
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®