xref: /linux/tools/testing/selftests/bpf/prog_tests/subprogs_extable.c (revision be239684b18e1cdcafcf8c7face4a2f562c745ad)
1 // SPDX-License-Identifier: GPL-2.0
2 
3 #include <test_progs.h>
4 #include "test_subprogs_extable.skel.h"
5 
6 void test_subprogs_extable(void)
7 {
8 	const int read_sz = 456;
9 	struct test_subprogs_extable *skel;
10 	int err;
11 
12 	skel = test_subprogs_extable__open_and_load();
13 	if (!ASSERT_OK_PTR(skel, "skel_open_and_load"))
14 		return;
15 
16 	err = test_subprogs_extable__attach(skel);
17 	if (!ASSERT_OK(err, "skel_attach"))
18 		goto cleanup;
19 
20 	/* trigger tracepoint */
21 	ASSERT_OK(trigger_module_test_read(read_sz), "trigger_read");
22 
23 	ASSERT_NEQ(skel->bss->triggered, 0, "verify at least one program ran");
24 
25 	test_subprogs_extable__detach(skel);
26 
27 cleanup:
28 	test_subprogs_extable__destroy(skel);
29 }
30