1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
3#include <test_progs.h>
4
5#include "struct_ops_multi_pages.skel.h"
6
7static void do_struct_ops_multi_pages(void)
8{
9 struct struct_ops_multi_pages *skel;
10 struct bpf_link *link;
11
12 /* The size of all trampolines of skel->maps.multi_pages should be
13 * over 1 page (at least for x86).
14 */
15 skel = struct_ops_multi_pages__open_and_load();
16 if (!ASSERT_OK_PTR(skel, "struct_ops_multi_pages_open_and_load"))
17 return;
18
19 link = bpf_map__attach_struct_ops(skel->maps.multi_pages);
20 ASSERT_OK_PTR(link, "attach_multi_pages");
21
22 bpf_link__destroy(link);
23 struct_ops_multi_pages__destroy(skel);
24}
25
26void test_struct_ops_multi_pages(void)
27{
28 if (test__start_subtest("multi_pages"))
29 do_struct_ops_multi_pages();
30}
31

source code of linux/tools/testing/selftests/bpf/prog_tests/test_struct_ops_multi_pages.c