xref: /linux/tools/testing/selftests/bpf/prog_tests/arena_strsearch.c (revision 24f171c7e145f43b9f187578e89b0982ce87e54c)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */
3 #include <test_progs.h>
4 #include "arena_strsearch.skel.h"
5 
6 static void test_arena_str(void)
7 {
8 	LIBBPF_OPTS(bpf_test_run_opts, opts);
9 	struct arena_strsearch *skel;
10 	int ret;
11 
12 	skel = arena_strsearch__open_and_load();
13 	if (!ASSERT_OK_PTR(skel, "arena_strsearch__open_and_load"))
14 		return;
15 
16 	ret = bpf_prog_test_run_opts(bpf_program__fd(skel->progs.arena_strsearch), &opts);
17 	ASSERT_OK(ret, "ret_add");
18 	ASSERT_OK(opts.retval, "retval");
19 	if (skel->bss->skip) {
20 		printf("%s:SKIP:compiler doesn't support arena_cast\n", __func__);
21 		test__skip();
22 	}
23 	arena_strsearch__destroy(skel);
24 }
25 
26 void test_arena_strsearch(void)
27 {
28 	if (test__start_subtest("arena_strsearch"))
29 		test_arena_str();
30 }
31