diff options
author | zhujun2 <zhujun2@cmss.chinamobile.com> | 2023-10-16 19:08:56 -0700 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2023-10-18 14:33:44 -0600 |
commit | ecc4185a4d15373cadab41277098e651d8dd3397 (patch) | |
tree | 0774f931e810e65e6fb1acbf48d5159cb8803a49 /tools/testing/selftests/kselftest.h | |
parent | selftests/efivarfs: create-read: fix a resource leak (diff) | |
download | wireguard-linux-ecc4185a4d15373cadab41277098e651d8dd3397.tar.xz wireguard-linux-ecc4185a4d15373cadab41277098e651d8dd3397.zip |
selftests:modify the incorrect print format
when the argument type is 'unsigned int',printf '%u'
in format string. Problem found during code reading.
Update commit log with information on how the problem
was found:
Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: zhujun2 <zhujun2@cmss.chinamobile.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/kselftest.h')
-rw-r--r-- | tools/testing/selftests/kselftest.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/testing/selftests/kselftest.h b/tools/testing/selftests/kselftest.h index 5696199c16f9..a781e6311810 100644 --- a/tools/testing/selftests/kselftest.h +++ b/tools/testing/selftests/kselftest.h @@ -132,7 +132,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) @@ -140,7 +140,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); @@ -179,7 +179,7 @@ static inline __printf(1, 2) 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); @@ -193,7 +193,7 @@ static inline __printf(1, 2) 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); @@ -219,7 +219,7 @@ static inline __printf(1, 2) 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); @@ -233,7 +233,7 @@ static inline __printf(1, 2) 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); @@ -248,7 +248,7 @@ static inline __printf(1, 2) 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); |