Message ID | 20221108015857.132457-1-yangjihong1@huawei.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 5704bc7e8991164b14efb748b5afa0715c25fac3 |
Delegated to: | BPF |
Headers | show |
Series | selftests/bpf: Fix test_progs compilation failure in 32-bit arch | expand |
Context | Check | Description |
---|---|---|
bpf/vmtest-bpf-next-PR | pending | PR summary |
bpf/vmtest-bpf-next-VM_Test-1 | pending | Logs for ShellCheck |
bpf/vmtest-bpf-next-VM_Test-5 | success | Logs for llvm-toolchain |
bpf/vmtest-bpf-next-VM_Test-6 | success | Logs for set-matrix |
bpf/vmtest-bpf-next-VM_Test-3 | success | Logs for build for x86_64 with gcc |
bpf/vmtest-bpf-next-VM_Test-4 | success | Logs for build for x86_64 with llvm-16 |
netdev/tree_selection | success | Not a local patch |
bpf/vmtest-bpf-next-VM_Test-2 | success | Logs for build for s390x with gcc |
bpf/vmtest-bpf-next-VM_Test-20 | success | Logs for test_progs_parallel on x86_64 with gcc |
bpf/vmtest-bpf-next-VM_Test-24 | success | Logs for test_verifier on x86_64 with llvm-16 |
bpf/vmtest-bpf-next-VM_Test-8 | success | Logs for test_maps on x86_64 with gcc |
bpf/vmtest-bpf-next-VM_Test-11 | success | Logs for test_progs on x86_64 with gcc |
bpf/vmtest-bpf-next-VM_Test-12 | success | Logs for test_progs on x86_64 with llvm-16 |
bpf/vmtest-bpf-next-VM_Test-14 | success | Logs for test_progs_no_alu32 on x86_64 with gcc |
bpf/vmtest-bpf-next-VM_Test-15 | success | Logs for test_progs_no_alu32 on x86_64 with llvm-16 |
bpf/vmtest-bpf-next-VM_Test-17 | success | Logs for test_progs_no_alu32_parallel on x86_64 with gcc |
bpf/vmtest-bpf-next-VM_Test-18 | success | Logs for test_progs_no_alu32_parallel on x86_64 with llvm-16 |
bpf/vmtest-bpf-next-VM_Test-19 | success | Logs for test_progs_parallel on s390x with gcc |
bpf/vmtest-bpf-next-VM_Test-21 | success | Logs for test_progs_parallel on x86_64 with llvm-16 |
bpf/vmtest-bpf-next-VM_Test-22 | success | Logs for test_verifier on s390x with gcc |
bpf/vmtest-bpf-next-VM_Test-23 | success | Logs for test_verifier on x86_64 with gcc |
bpf/vmtest-bpf-next-VM_Test-7 | success | Logs for test_maps on s390x with gcc |
bpf/vmtest-bpf-next-VM_Test-9 | success | Logs for test_maps on x86_64 with llvm-16 |
bpf/vmtest-bpf-next-VM_Test-10 | success | Logs for test_progs on s390x with gcc |
bpf/vmtest-bpf-next-VM_Test-16 | success | Logs for test_progs_no_alu32_parallel on s390x with gcc |
bpf/vmtest-bpf-next-VM_Test-13 | success | Logs for test_progs_no_alu32 on s390x with gcc |
On 11/7/22 5:58 PM, Yang Jihong wrote: > test_progs fails to be compiled in the 32-bit arch, log is as follows: > > test_progs.c:1013:52: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] > 1013 | sprintf(buf, "MSG_TEST_LOG (cnt: %ld, last: %d)", > | ~~^ > | | > | long int > | %d > 1014 | strlen(msg->test_log.log_buf), > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > | | > | size_t {aka unsigned int} > > Fix it. > > Fixes: 91b2c0afd00c ("selftests/bpf: Add parallelism to test_progs") > Signed-off-by: Yang Jihong <yangjihong1@huawei.com> Acked-by: Yonghong Song <yhs@fb.com>
Hello: This patch was applied to bpf/bpf.git (master) by Martin KaFai Lau <martin.lau@kernel.org>: On Tue, 8 Nov 2022 09:58:57 +0800 you wrote: > test_progs fails to be compiled in the 32-bit arch, log is as follows: > > test_progs.c:1013:52: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] > 1013 | sprintf(buf, "MSG_TEST_LOG (cnt: %ld, last: %d)", > | ~~^ > | | > | long int > | %d > 1014 | strlen(msg->test_log.log_buf), > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > | | > | size_t {aka unsigned int} > > [...] Here is the summary with links: - selftests/bpf: Fix test_progs compilation failure in 32-bit arch https://git.kernel.org/bpf/bpf/c/5704bc7e8991 You are awesome, thank you!
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 0e9a47f97890..3fef451d8831 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -1010,7 +1010,7 @@ static inline const char *str_msg(const struct msg *msg, char *buf) msg->subtest_done.have_log); break; case MSG_TEST_LOG: - sprintf(buf, "MSG_TEST_LOG (cnt: %ld, last: %d)", + sprintf(buf, "MSG_TEST_LOG (cnt: %zu, last: %d)", strlen(msg->test_log.log_buf), msg->test_log.is_last); break;
test_progs fails to be compiled in the 32-bit arch, log is as follows: test_progs.c:1013:52: error: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Werror=format=] 1013 | sprintf(buf, "MSG_TEST_LOG (cnt: %ld, last: %d)", | ~~^ | | | long int | %d 1014 | strlen(msg->test_log.log_buf), | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | size_t {aka unsigned int} Fix it. Fixes: 91b2c0afd00c ("selftests/bpf: Add parallelism to test_progs") Signed-off-by: Yang Jihong <yangjihong1@huawei.com> --- tools/testing/selftests/bpf/test_progs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)