提交 99182bee 编写于 作者: D Daniel Borkmann

Merge branch 'bpf-selftest-clang-fixes'

Stanislav Fomichev says:

====================
This series contains small fixes to make bpf selftests compile cleanly
with clangs. All of them are not real problems, but it's nice to have
an option to use clang for the tests themselves.
====================
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
...@@ -209,7 +209,7 @@ ifeq ($(DWARF2BTF),y) ...@@ -209,7 +209,7 @@ ifeq ($(DWARF2BTF),y)
endif endif
PROG_TESTS_H := $(OUTPUT)/prog_tests/tests.h PROG_TESTS_H := $(OUTPUT)/prog_tests/tests.h
$(OUTPUT)/test_progs: $(PROG_TESTS_H) test_progs.c: $(PROG_TESTS_H)
$(OUTPUT)/test_progs: CFLAGS += $(TEST_PROGS_CFLAGS) $(OUTPUT)/test_progs: CFLAGS += $(TEST_PROGS_CFLAGS)
$(OUTPUT)/test_progs: prog_tests/*.c $(OUTPUT)/test_progs: prog_tests/*.c
...@@ -232,7 +232,7 @@ $(PROG_TESTS_H): $(PROG_TESTS_DIR) $(PROG_TESTS_FILES) ...@@ -232,7 +232,7 @@ $(PROG_TESTS_H): $(PROG_TESTS_DIR) $(PROG_TESTS_FILES)
) > $(PROG_TESTS_H)) ) > $(PROG_TESTS_H))
VERIFIER_TESTS_H := $(OUTPUT)/verifier/tests.h VERIFIER_TESTS_H := $(OUTPUT)/verifier/tests.h
$(OUTPUT)/test_verifier: $(VERIFIER_TESTS_H) test_verifier.c: $(VERIFIER_TESTS_H)
$(OUTPUT)/test_verifier: CFLAGS += $(TEST_VERIFIER_CFLAGS) $(OUTPUT)/test_verifier: CFLAGS += $(TEST_VERIFIER_CFLAGS)
VERIFIER_TESTS_DIR = $(OUTPUT)/verifier VERIFIER_TESTS_DIR = $(OUTPUT)/verifier
......
...@@ -52,7 +52,7 @@ static void detach_program(void) ...@@ -52,7 +52,7 @@ static void detach_program(void)
sprintf(command, "rm -r %s", cfg_pin_path); sprintf(command, "rm -r %s", cfg_pin_path);
ret = system(command); ret = system(command);
if (ret) if (ret)
error(1, errno, command); error(1, errno, "%s", command);
} }
static void parse_opts(int argc, char **argv) static void parse_opts(int argc, char **argv)
......
...@@ -73,7 +73,7 @@ void test_bpf_obj_id(void) ...@@ -73,7 +73,7 @@ void test_bpf_obj_id(void)
info_len != sizeof(struct bpf_map_info) || info_len != sizeof(struct bpf_map_info) ||
strcmp((char *)map_infos[i].name, expected_map_name), strcmp((char *)map_infos[i].name, expected_map_name),
"get-map-info(fd)", "get-map-info(fd)",
"err %d errno %d type %d(%d) info_len %u(%Zu) key_size %u value_size %u max_entries %u map_flags %X name %s(%s)\n", "err %d errno %d type %d(%d) info_len %u(%zu) key_size %u value_size %u max_entries %u map_flags %X name %s(%s)\n",
err, errno, err, errno,
map_infos[i].type, BPF_MAP_TYPE_ARRAY, map_infos[i].type, BPF_MAP_TYPE_ARRAY,
info_len, sizeof(struct bpf_map_info), info_len, sizeof(struct bpf_map_info),
...@@ -117,7 +117,7 @@ void test_bpf_obj_id(void) ...@@ -117,7 +117,7 @@ void test_bpf_obj_id(void)
*(int *)(long)prog_infos[i].map_ids != map_infos[i].id || *(int *)(long)prog_infos[i].map_ids != map_infos[i].id ||
strcmp((char *)prog_infos[i].name, expected_prog_name), strcmp((char *)prog_infos[i].name, expected_prog_name),
"get-prog-info(fd)", "get-prog-info(fd)",
"err %d errno %d i %d type %d(%d) info_len %u(%Zu) jit_enabled %d jited_prog_len %u xlated_prog_len %u jited_prog %d xlated_prog %d load_time %lu(%lu) uid %u(%u) nr_map_ids %u(%u) map_id %u(%u) name %s(%s)\n", "err %d errno %d i %d type %d(%d) info_len %u(%zu) jit_enabled %d jited_prog_len %u xlated_prog_len %u jited_prog %d xlated_prog %d load_time %lu(%lu) uid %u(%u) nr_map_ids %u(%u) map_id %u(%u) name %s(%s)\n",
err, errno, i, err, errno, i,
prog_infos[i].type, BPF_PROG_TYPE_SOCKET_FILTER, prog_infos[i].type, BPF_PROG_TYPE_SOCKET_FILTER,
info_len, sizeof(struct bpf_prog_info), info_len, sizeof(struct bpf_prog_info),
...@@ -185,7 +185,7 @@ void test_bpf_obj_id(void) ...@@ -185,7 +185,7 @@ void test_bpf_obj_id(void)
memcmp(&prog_info, &prog_infos[i], info_len) || memcmp(&prog_info, &prog_infos[i], info_len) ||
*(int *)(long)prog_info.map_ids != saved_map_id, *(int *)(long)prog_info.map_ids != saved_map_id,
"get-prog-info(next_id->fd)", "get-prog-info(next_id->fd)",
"err %d errno %d info_len %u(%Zu) memcmp %d map_id %u(%u)\n", "err %d errno %d info_len %u(%zu) memcmp %d map_id %u(%u)\n",
err, errno, info_len, sizeof(struct bpf_prog_info), err, errno, info_len, sizeof(struct bpf_prog_info),
memcmp(&prog_info, &prog_infos[i], info_len), memcmp(&prog_info, &prog_infos[i], info_len),
*(int *)(long)prog_info.map_ids, saved_map_id); *(int *)(long)prog_info.map_ids, saved_map_id);
...@@ -231,7 +231,7 @@ void test_bpf_obj_id(void) ...@@ -231,7 +231,7 @@ void test_bpf_obj_id(void)
memcmp(&map_info, &map_infos[i], info_len) || memcmp(&map_info, &map_infos[i], info_len) ||
array_value != array_magic_value, array_value != array_magic_value,
"check get-map-info(next_id->fd)", "check get-map-info(next_id->fd)",
"err %d errno %d info_len %u(%Zu) memcmp %d array_value %llu(%llu)\n", "err %d errno %d info_len %u(%zu) memcmp %d array_value %llu(%llu)\n",
err, errno, info_len, sizeof(struct bpf_map_info), err, errno, info_len, sizeof(struct bpf_map_info),
memcmp(&map_info, &map_infos[i], info_len), memcmp(&map_info, &map_infos[i], info_len),
array_value, array_magic_value); array_value, array_magic_value);
......
...@@ -705,7 +705,6 @@ ...@@ -705,7 +705,6 @@
.errstr = "invalid bpf_context access", .errstr = "invalid bpf_context access",
.result = REJECT, .result = REJECT,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS, .flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
.flags = F_NEEDS_EFFICIENT_UNALIGNED_ACCESS,
}, },
{ {
"check cb access: half, wrong type", "check cb access: half, wrong type",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册