aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests
diff options
context:
space:
mode:
authorJakub Sitnicki <jakub@cloudflare.com>2025-08-14 11:59:30 +0200
committerMartin KaFai Lau <martin.lau@kernel.org>2025-08-18 10:29:42 -0700
commit6dfd5e01e1a7728e162f721cd8adf5ecd24fbc80 (patch)
tree0505d5357c0759f527387d1f8091e08d8b9cdc2e /tools/testing/selftests/bpf/prog_tests
parentselftests/bpf: Cover verifier checks for skb_meta dynptr type (diff)
downloadlinux-6dfd5e01e1a7728e162f721cd8adf5ecd24fbc80.tar.gz
linux-6dfd5e01e1a7728e162f721cd8adf5ecd24fbc80.zip
selftests/bpf: Pass just bpf_map to xdp_context_test helper
Prepare for parametrizing the xdp_context tests. The assert_test_result helper doesn't need the whole skeleton. Pass just what it needs. Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Reviewed-by: Jesse Brandeburg <jbrandeburg@cloudflare.com> Acked-by: Eduard Zingerman <eddyz87@gmail.com> Link: https://patch.msgid.link/20250814-skb-metadata-thru-dynptr-v7-4-8a39e636e0fb@cloudflare.com
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c b/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
index b9d9f0a502ce..0134651d94ab 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c
@@ -156,15 +156,14 @@ err:
return -1;
}
-static void assert_test_result(struct test_xdp_meta *skel)
+static void assert_test_result(const struct bpf_map *result_map)
{
int err;
__u32 map_key = 0;
__u8 map_value[TEST_PAYLOAD_LEN];
- err = bpf_map__lookup_elem(skel->maps.test_result, &map_key,
- sizeof(map_key), &map_value,
- TEST_PAYLOAD_LEN, BPF_ANY);
+ err = bpf_map__lookup_elem(result_map, &map_key, sizeof(map_key),
+ &map_value, TEST_PAYLOAD_LEN, BPF_ANY);
if (!ASSERT_OK(err, "lookup test_result"))
return;
@@ -248,7 +247,7 @@ void test_xdp_context_veth(void)
if (!ASSERT_OK(ret, "send_test_packet"))
goto close;
- assert_test_result(skel);
+ assert_test_result(skel->maps.test_result);
close:
close_netns(nstoken);
@@ -313,7 +312,7 @@ void test_xdp_context_tuntap(void)
if (!ASSERT_EQ(ret, sizeof(packet), "write packet"))
goto close;
- assert_test_result(skel);
+ assert_test_result(skel->maps.test_result);
close:
if (tap_fd >= 0)