mirror of https://gitee.com/openkylin/linux.git
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: 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
This commit is contained in:
parent
8af1c8b8d6
commit
1678e33c21
|
@ -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))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue