xref: /linux/tools/testing/selftests/bpf/prog_tests/raw_tp_null.c (revision 35f301dd4551fa731db4834f915e8351838f6f19)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
3 
4 #include <test_progs.h>
5 #include "raw_tp_null.skel.h"
6 #include "raw_tp_null_fail.skel.h"
7 
test_raw_tp_null(void)8 void test_raw_tp_null(void)
9 {
10 	struct raw_tp_null *skel;
11 
12 	RUN_TESTS(raw_tp_null_fail);
13 
14 	skel = raw_tp_null__open_and_load();
15 	if (!ASSERT_OK_PTR(skel, "raw_tp_null__open_and_load"))
16 		return;
17 
18 	skel->bss->tid = sys_gettid();
19 
20 	if (!ASSERT_OK(raw_tp_null__attach(skel), "raw_tp_null__attach"))
21 		goto end;
22 
23 	ASSERT_OK(trigger_module_test_read(2), "trigger testmod read");
24 	ASSERT_EQ(skel->bss->i, 3, "invocations");
25 
26 end:
27 	raw_tp_null__destroy(skel);
28 }
29