Skip to content

Commit

Permalink
selftests/bpf: remove last tests with legacy BPF map definitions
Browse files Browse the repository at this point in the history
Libbpf 1.0 stops support legacy-style BPF map definitions. Selftests has
been migrated away from using legacy BPF map definitions except for two
selftests, to make sure that legacy functionality still worked in
pre-1.0 libbpf. Now it's time to let those tests go as libbpf 1.0 is
imminent.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20220627211527.2245459-14-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
  • Loading branch information
Andrii Nakryiko authored and Alexei Starovoitov committed Jun 28, 2022
1 parent 450b167 commit 31e4272
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 79 deletions.
9 changes: 0 additions & 9 deletions tools/testing/selftests/bpf/bpf_legacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
#ifndef __BPF_LEGACY__
#define __BPF_LEGACY__

#define BPF_ANNOTATE_KV_PAIR(name, type_key, type_val) \
struct ____btf_map_##name { \
type_key key; \
type_val value; \
}; \
struct ____btf_map_##name \
__attribute__ ((section(".maps." #name), used)) \
____btf_map_##name = { }

/* llvm builtin functions that eBPF C program may use to
* emit BPF_LD_ABS and BPF_LD_IND instructions
*/
Expand Down
1 change: 0 additions & 1 deletion tools/testing/selftests/bpf/prog_tests/btf.c
Original file line number Diff line number Diff line change
Expand Up @@ -4651,7 +4651,6 @@ struct btf_file_test {
};

static struct btf_file_test file_tests[] = {
{ .file = "test_btf_haskv.o", },
{ .file = "test_btf_newkv.o", },
{ .file = "test_btf_nokv.o", .btf_kv_notfound = true, },
};
Expand Down
51 changes: 0 additions & 51 deletions tools/testing/selftests/bpf/progs/test_btf_haskv.c

This file was deleted.

18 changes: 0 additions & 18 deletions tools/testing/selftests/bpf/progs/test_btf_newkv.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ struct ipv_counts {
unsigned int v6;
};

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* just to validate we can handle maps in multiple sections */
struct bpf_map_def SEC("maps") btf_map_legacy = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(int),
.value_size = sizeof(long long),
.max_entries = 4,
};
#pragma GCC diagnostic pop

BPF_ANNOTATE_KV_PAIR(btf_map_legacy, int, struct ipv_counts);

struct {
__uint(type, BPF_MAP_TYPE_ARRAY);
__uint(max_entries, 4);
Expand All @@ -41,11 +28,6 @@ int test_long_fname_2(void)

counts->v6++;

/* just verify we can reference both maps */
counts = bpf_map_lookup_elem(&btf_map_legacy, &key);
if (!counts)
return 0;

return 0;
}

Expand Down

0 comments on commit 31e4272

Please sign in to comment.