selftest/bpf: Get rid of a bunch of explicit BPF program type setting
authorAndrii Nakryiko <andriin@fb.com>
Mon, 21 Oct 2019 03:39:02 +0000 (20:39 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 21 Oct 2019 12:49:12 +0000 (14:49 +0200)
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
tools/testing/selftests/bpf/prog_tests/attach_probe.c
tools/testing/selftests/bpf/prog_tests/core_reloc.c
tools/testing/selftests/bpf/prog_tests/rdonly_maps.c
tools/testing/selftests/bpf/test_maps.c

index 4f50d32c4abb5cedb57bb642930bb68840d3da4a..0ee1ce100a4a262f0b2665b31bc386836822acf3 100644 (file)
@@ -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))
index 2b3586dc6c865ef9a2404e9d5c4e41ae50990e91..523dca82dc8285605c461c5dda43bd40d9c6893b 100644 (file)
@@ -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;
index 9bf9de0aaeea4d65c535e2897314f901e544e7f5..d90acc13d1ecf3a9050457b1c3b4e53c15c54461 100644 (file)
@@ -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;
index 806b298397d34127d3b5955cb699e23a675665f7..02eae1e864c2237fd9b5ca046d406515a3b5f7eb 100644 (file)
@@ -1142,7 +1142,6 @@ out_sockmap:
 #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");