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