Skip to content

Commit 6dfd5e0

Browse files
jsitnickiMartin KaFai Lau
authored andcommitted
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 <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Reviewed-by: Jesse Brandeburg <[email protected]> Acked-by: Eduard Zingerman <[email protected]> Link: https://patch.msgid.link/20250814-skb-metadata-thru-dynptr-v7-4-8a39e636e0fb@cloudflare.com
1 parent 0e74eb4 commit 6dfd5e0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tools/testing/selftests/bpf/prog_tests/xdp_context_test_run.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,14 @@ static int send_test_packet(int ifindex)
156156
return -1;
157157
}
158158

159-
static void assert_test_result(struct test_xdp_meta *skel)
159+
static void assert_test_result(const struct bpf_map *result_map)
160160
{
161161
int err;
162162
__u32 map_key = 0;
163163
__u8 map_value[TEST_PAYLOAD_LEN];
164164

165-
err = bpf_map__lookup_elem(skel->maps.test_result, &map_key,
166-
sizeof(map_key), &map_value,
167-
TEST_PAYLOAD_LEN, BPF_ANY);
165+
err = bpf_map__lookup_elem(result_map, &map_key, sizeof(map_key),
166+
&map_value, TEST_PAYLOAD_LEN, BPF_ANY);
168167
if (!ASSERT_OK(err, "lookup test_result"))
169168
return;
170169

@@ -248,7 +247,7 @@ void test_xdp_context_veth(void)
248247
if (!ASSERT_OK(ret, "send_test_packet"))
249248
goto close;
250249

251-
assert_test_result(skel);
250+
assert_test_result(skel->maps.test_result);
252251

253252
close:
254253
close_netns(nstoken);
@@ -313,7 +312,7 @@ void test_xdp_context_tuntap(void)
313312
if (!ASSERT_EQ(ret, sizeof(packet), "write packet"))
314313
goto close;
315314

316-
assert_test_result(skel);
315+
assert_test_result(skel->maps.test_result);
317316

318317
close:
319318
if (tap_fd >= 0)

0 commit comments

Comments
 (0)