Skip to content

Commit

Permalink
selftest/bpf: Get rid of a bunch of explicit BPF program type setting
Browse files Browse the repository at this point in the history
Now that libbpf can correctly guess BPF program types from section
names, remove a bunch of explicit bpf_program__set_type() calls
throughout tests.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191021033902.3856966-8-andriin@fb.com
  • Loading branch information
Andrii Nakryiko authored and Daniel Borkmann committed Oct 21, 2019
1 parent 8af1c8b commit 1678e33
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 14 deletions.
5 changes: 0 additions & 5 deletions tools/testing/selftests/bpf/prog_tests/attach_probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ void test_attach_probe(void)
"prog '%s' not found\n", uretprobe_name))
goto cleanup;

bpf_program__set_kprobe(kprobe_prog);
bpf_program__set_kprobe(kretprobe_prog);
bpf_program__set_kprobe(uprobe_prog);
bpf_program__set_kprobe(uretprobe_prog);

/* create maps && load programs */
err = bpf_object__load(obj);
if (CHECK(err, "obj_load", "err %d\n", err))
Expand Down
1 change: 0 additions & 1 deletion tools/testing/selftests/bpf/prog_tests/core_reloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ void test_core_reloc(void)
if (CHECK(!prog, "find_probe",
"prog '%s' not found\n", probe_name))
goto cleanup;
bpf_program__set_type(prog, BPF_PROG_TYPE_RAW_TRACEPOINT);

load_attr.obj = obj;
load_attr.log_level = 0;
Expand Down
4 changes: 0 additions & 4 deletions tools/testing/selftests/bpf/prog_tests/rdonly_maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ void test_rdonly_maps(void)
if (CHECK(IS_ERR(obj), "obj_open", "err %ld\n", PTR_ERR(obj)))
return;

bpf_object__for_each_program(prog, obj) {
bpf_program__set_raw_tracepoint(prog);
}

err = bpf_object__load(obj);
if (CHECK(err, "obj_load", "err %d errno %d\n", err, errno))
goto cleanup;
Expand Down
4 changes: 0 additions & 4 deletions tools/testing/selftests/bpf/test_maps.c
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,6 @@ static void test_sockmap(unsigned int tasks, void *data)
#define MAPINMAP_PROG "./test_map_in_map.o"
static void test_map_in_map(void)
{
struct bpf_program *prog;
struct bpf_object *obj;
struct bpf_map *map;
int mim_fd, fd, err;
Expand Down Expand Up @@ -1179,9 +1178,6 @@ static void test_map_in_map(void)
goto out_map_in_map;
}

bpf_object__for_each_program(prog, obj) {
bpf_program__set_xdp(prog);
}
bpf_object__load(obj);

map = bpf_object__find_map_by_name(obj, "mim_array");
Expand Down

0 comments on commit 1678e33

Please sign in to comment.