Commit 1678e33c authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Daniel Borkmann

selftest/bpf: Get rid of a bunch of explicit BPF program type setting

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: default avatarAndrii Nakryiko <andriin@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191021033902.3856966-8-andriin@fb.com
parent 8af1c8b8
...@@ -99,11 +99,6 @@ void test_attach_probe(void) ...@@ -99,11 +99,6 @@ void test_attach_probe(void)
"prog '%s' not found\n", uretprobe_name)) "prog '%s' not found\n", uretprobe_name))
goto cleanup; 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 */ /* create maps && load programs */
err = bpf_object__load(obj); err = bpf_object__load(obj);
if (CHECK(err, "obj_load", "err %d\n", err)) if (CHECK(err, "obj_load", "err %d\n", err))
......
...@@ -391,7 +391,6 @@ void test_core_reloc(void) ...@@ -391,7 +391,6 @@ void test_core_reloc(void)
if (CHECK(!prog, "find_probe", if (CHECK(!prog, "find_probe",
"prog '%s' not found\n", probe_name)) "prog '%s' not found\n", probe_name))
goto cleanup; goto cleanup;
bpf_program__set_type(prog, BPF_PROG_TYPE_RAW_TRACEPOINT);
load_attr.obj = obj; load_attr.obj = obj;
load_attr.log_level = 0; load_attr.log_level = 0;
......
...@@ -36,10 +36,6 @@ void test_rdonly_maps(void) ...@@ -36,10 +36,6 @@ void test_rdonly_maps(void)
if (CHECK(IS_ERR(obj), "obj_open", "err %ld\n", PTR_ERR(obj))) if (CHECK(IS_ERR(obj), "obj_open", "err %ld\n", PTR_ERR(obj)))
return; return;
bpf_object__for_each_program(prog, obj) {
bpf_program__set_raw_tracepoint(prog);
}
err = bpf_object__load(obj); err = bpf_object__load(obj);
if (CHECK(err, "obj_load", "err %d errno %d\n", err, errno)) if (CHECK(err, "obj_load", "err %d errno %d\n", err, errno))
goto cleanup; goto cleanup;
......
...@@ -1142,7 +1142,6 @@ static void test_sockmap(unsigned int tasks, void *data) ...@@ -1142,7 +1142,6 @@ static void test_sockmap(unsigned int tasks, void *data)
#define MAPINMAP_PROG "./test_map_in_map.o" #define MAPINMAP_PROG "./test_map_in_map.o"
static void test_map_in_map(void) static void test_map_in_map(void)
{ {
struct bpf_program *prog;
struct bpf_object *obj; struct bpf_object *obj;
struct bpf_map *map; struct bpf_map *map;
int mim_fd, fd, err; int mim_fd, fd, err;
...@@ -1179,9 +1178,6 @@ static void test_map_in_map(void) ...@@ -1179,9 +1178,6 @@ static void test_map_in_map(void)
goto out_map_in_map; goto out_map_in_map;
} }
bpf_object__for_each_program(prog, obj) {
bpf_program__set_xdp(prog);
}
bpf_object__load(obj); bpf_object__load(obj);
map = bpf_object__find_map_by_name(obj, "mim_array"); map = bpf_object__find_map_by_name(obj, "mim_array");
......
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