selftests/bpf: Split test_attach_probe into multi subtests
authorMenglong Dong <imagedong@tencent.com>
Mon, 6 Mar 2023 06:48:32 +0000 (14:48 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 6 Mar 2023 17:38:08 +0000 (09:38 -0800)
commit7391ec6391e2b129aeaee5462487c404f61157aa
tree9787aaa665eda76ccd821d4bb1fbd6b749b6e043
parentf8b299bc6a0f8695d4005ecff29773c79a1d29af
selftests/bpf: Split test_attach_probe into multi subtests

In order to adapt to the older kernel, now we split the "attach_probe"
testing into multi subtests:

  manual // manual attach tests for kprobe/uprobe
  auto // auto-attach tests for kprobe and uprobe
  kprobe-sleepable // kprobe sleepable test
  uprobe-lib // uprobe tests for library function by name
  uprobe-sleepable // uprobe sleepable test
  uprobe-ref_ctr // uprobe ref_ctr test

As sleepable kprobe needs to set BPF_F_SLEEPABLE flag before loading,
we need to move it to a stand alone skel file, in case of it is not
supported by kernel and make the whole loading fail.

Therefore, we can only enable part of the subtests for older kernel.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Biao Jiang <benbjiang@tencent.com>
Link: https://lore.kernel.org/bpf/20230306064833.7932-3-imagedong@tencent.com
tools/testing/selftests/bpf/prog_tests/attach_probe.c
tools/testing/selftests/bpf/progs/test_attach_kprobe_sleepable.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/test_attach_probe.c