selftests/bpf: make xdp_cpumap_attach keep redirect prog attached
authorAlexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Wed, 9 Oct 2024 10:12:08 +0000 (12:12 +0200)
committerMartin KaFai Lau <martin.lau@kernel.org>
Fri, 11 Oct 2024 01:01:42 +0000 (18:01 -0700)
commitd5fbcf46ee82574aee443423f3e4132d1154372b
tree0eb597edd0c10ed5ab20093dc1b405e8952a4db6
parentac8d16b2d3772934f4cba44cb01bad05b4b2864c
selftests/bpf: make xdp_cpumap_attach keep redirect prog attached

Current test only checks attach/detach on cpu map type program, and so
does not check that it can be properly executed, neither that it
redirects correctly.

Update the existing test to extend its coverage:
- keep the redirected program loaded
- try to execute it through bpf_prog_test_run_opts with some dummy
  context

While at it, bring the following minor improvements:
- isolate test interface in its own namespace

Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20241009-convert_xdp_tests-v3-2-51cea913710c@bootlin.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c