Commit ecc4185a authored by zhujun2's avatar zhujun2 Committed by Shuah Khan

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: default avatarzhujun2 <zhujun2@cmss.chinamobile.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 3f6f8a8c
...@@ -132,7 +132,7 @@ static inline void ksft_print_header(void) ...@@ -132,7 +132,7 @@ static inline void ksft_print_header(void)
static inline void ksft_set_plan(unsigned int plan) static inline void ksft_set_plan(unsigned int plan)
{ {
ksft_plan = plan; ksft_plan = plan;
printf("1..%d\n", ksft_plan); printf("1..%u\n", ksft_plan);
} }
static inline void ksft_print_cnts(void) static inline void ksft_print_cnts(void)
...@@ -140,7 +140,7 @@ static inline void ksft_print_cnts(void) ...@@ -140,7 +140,7 @@ static inline void ksft_print_cnts(void)
if (ksft_plan != ksft_test_num()) if (ksft_plan != ksft_test_num())
printf("# Planned tests != run tests (%u != %u)\n", printf("# Planned tests != run tests (%u != %u)\n",
ksft_plan, ksft_test_num()); 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_pass, ksft_cnt.ksft_fail,
ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass, ksft_cnt.ksft_xfail, ksft_cnt.ksft_xpass,
ksft_cnt.ksft_xskip, ksft_cnt.ksft_error); 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, ...) ...@@ -179,7 +179,7 @@ static inline __printf(1, 2) void ksft_test_result_pass(const char *msg, ...)
ksft_cnt.ksft_pass++; ksft_cnt.ksft_pass++;
va_start(args, msg); va_start(args, msg);
printf("ok %d ", ksft_test_num()); printf("ok %u ", ksft_test_num());
errno = saved_errno; errno = saved_errno;
vprintf(msg, args); vprintf(msg, args);
va_end(args); va_end(args);
...@@ -193,7 +193,7 @@ static inline __printf(1, 2) void ksft_test_result_fail(const char *msg, ...) ...@@ -193,7 +193,7 @@ static inline __printf(1, 2) void ksft_test_result_fail(const char *msg, ...)
ksft_cnt.ksft_fail++; ksft_cnt.ksft_fail++;
va_start(args, msg); va_start(args, msg);
printf("not ok %d ", ksft_test_num()); printf("not ok %u ", ksft_test_num());
errno = saved_errno; errno = saved_errno;
vprintf(msg, args); vprintf(msg, args);
va_end(args); va_end(args);
...@@ -219,7 +219,7 @@ static inline __printf(1, 2) void ksft_test_result_xfail(const char *msg, ...) ...@@ -219,7 +219,7 @@ static inline __printf(1, 2) void ksft_test_result_xfail(const char *msg, ...)
ksft_cnt.ksft_xfail++; ksft_cnt.ksft_xfail++;
va_start(args, msg); va_start(args, msg);
printf("ok %d # XFAIL ", ksft_test_num()); printf("ok %u # XFAIL ", ksft_test_num());
errno = saved_errno; errno = saved_errno;
vprintf(msg, args); vprintf(msg, args);
va_end(args); va_end(args);
...@@ -233,7 +233,7 @@ static inline __printf(1, 2) void ksft_test_result_skip(const char *msg, ...) ...@@ -233,7 +233,7 @@ static inline __printf(1, 2) void ksft_test_result_skip(const char *msg, ...)
ksft_cnt.ksft_xskip++; ksft_cnt.ksft_xskip++;
va_start(args, msg); va_start(args, msg);
printf("ok %d # SKIP ", ksft_test_num()); printf("ok %u # SKIP ", ksft_test_num());
errno = saved_errno; errno = saved_errno;
vprintf(msg, args); vprintf(msg, args);
va_end(args); va_end(args);
...@@ -248,7 +248,7 @@ static inline __printf(1, 2) void ksft_test_result_error(const char *msg, ...) ...@@ -248,7 +248,7 @@ static inline __printf(1, 2) void ksft_test_result_error(const char *msg, ...)
ksft_cnt.ksft_error++; ksft_cnt.ksft_error++;
va_start(args, msg); va_start(args, msg);
printf("not ok %d # error ", ksft_test_num()); printf("not ok %u # error ", ksft_test_num());
errno = saved_errno; errno = saved_errno;
vprintf(msg, args); vprintf(msg, args);
va_end(args); va_end(args);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment