]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/bpf: convert get_current_cgroup_id_user to test_progs
authorAlexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Tue, 13 Aug 2024 12:45:05 +0000 (14:45 +0200)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 15 Aug 2024 01:10:46 +0000 (18:10 -0700)
commita4ae5c31e0f28d2c737583a06d4b29ffd6bbd622
tree5d464e4fea95928f49cd0983c34379c2dd55ce6a
parent4a4c013d3385b0db85dc361203dc42ff048b6fd6
selftests/bpf: convert get_current_cgroup_id_user to test_progs

get_current_cgroup_id_user allows testing for bpf_get_current_cgroup_id()
bpf API but is not integrated into test_progs, and so is not tested
automatically in CI.

Convert it to the test_progs framework to allow running it automatically.
The most notable differences with the old test are the following:
- the new test relies on autoattach instead of manually hooking/enabling
  the targeted tracepoint through perf_event, which reduces quite a lot the
  test code size
- it also accesses bpf prog data through global variables instead of maps
- sleep duration passed to nanosleep syscall has been reduced to its
  minimum to not impact overall CI duration (we only care about the syscall
  being properly triggered, not about the passed duration)

Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20240813-convert_cgroup_tests-v4-1-a33c03458cf6@bootlin.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/.gitignore
tools/testing/selftests/bpf/Makefile
tools/testing/selftests/bpf/get_cgroup_id_user.c [deleted file]
tools/testing/selftests/bpf/prog_tests/cgroup_get_current_cgroup_id.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c