Re: [PATCHv3 bpf-next 19/26] selftests/bpf: Add uprobe_multi link test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 30, 2023 at 1:37 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
>
> Adding uprobe_multi test for bpf_link_create attach function.
>
> Testing attachment using the struct bpf_link_create_opts.
>
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> ---
>  .../bpf/prog_tests/uprobe_multi_test.c        | 68 +++++++++++++++++++
>  1 file changed, 68 insertions(+)
>

[...]

> +       opts.kprobe_multi.flags = BPF_F_UPROBE_MULTI_RETURN;
> +       prog_fd = bpf_program__fd(skel->progs.test_uretprobe);
> +       link2_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts);
> +       if (!ASSERT_GE(link2_fd, 0, "link2_fd"))
> +               goto cleanup;
> +
> +       opts.kprobe_multi.flags = 0;
> +       prog_fd = bpf_program__fd(skel->progs.test_uprobe_sleep);
> +       link3_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts);
> +       if (!ASSERT_GE(link1_fd, 0, "link3_fd"))

link3_fd

> +               goto cleanup;
> +
> +       opts.kprobe_multi.flags = BPF_F_UPROBE_MULTI_RETURN;
> +       prog_fd = bpf_program__fd(skel->progs.test_uretprobe_sleep);
> +       link4_fd = bpf_link_create(prog_fd, 0, BPF_TRACE_UPROBE_MULTI, &opts);
> +       if (!ASSERT_GE(link2_fd, 0, "link4_fd"))

link4_fd

> +               goto cleanup;
> +       uprobe_multi_test_run(skel);
> +
> +cleanup:
> +       if (link1_fd >= 0)
> +               close(link1_fd);
> +       if (link2_fd >= 0)
> +               close(link2_fd);
> +       if (link3_fd >= 0)
> +               close(link3_fd);
> +       if (link4_fd >= 0)
> +               close(link4_fd);
> +
> +       uprobe_multi__destroy(skel);
> +       free(offsets);
> +}
> +
>  void test_uprobe_multi_test(void)
>  {
>         if (test__start_subtest("skel_api"))
> @@ -144,4 +210,6 @@ void test_uprobe_multi_test(void)
>                 test_attach_api_pattern();
>         if (test__start_subtest("attach_api_syms"))
>                 test_attach_api_syms();
> +       if (test__start_subtest("link_api"))
> +               test_link_api();
>  }
> --
> 2.41.0
>





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux