selftests/bpf: get rid of global vars in btf_skc_cls_ingress
authorAlexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Sun, 20 Oct 2024 19:22:55 +0000 (21:22 +0200)
committerMartin KaFai Lau <martin.lau@kernel.org>
Mon, 21 Oct 2024 18:49:15 +0000 (11:49 -0700)
commit0da0a75cf649e1e5a688af1763653206260f17a9
tree3772f8a7ca6c94a4869921867cfb5d49527c934e
parent0335dd6b5a4c178d9ae34694a0be7862873378bd
selftests/bpf: get rid of global vars in btf_skc_cls_ingress

There are a few global variables in btf_skc_cls_ingress.c, which are not
really used by different tests. Get rid of those global variables, by
performing the following updates:
- make srv_sa6 local to the main runner function
- make skel local to the main function, and propagate it through
  function arguments
- get rid of duration by replacing CHECK macros with the ASSERT_XXX
  macros. While updating those assert macros:
  - do not return early on asserts performing some actual tests, let the
    other tests run as well (keep the early return for parts handling
    test setup)
  - instead of converting the CHECK on skel->bss->linum, just remove it,
    since there is already a call to print_err_line after the test to
    print the failing line in the bpf program

Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@bootlin.com>
Link: https://lore.kernel.org/r/20241020-syncookie-v2-3-2db240225fed@bootlin.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/testing/selftests/bpf/prog_tests/btf_skc_cls_ingress.c