File Index
Files and directories
Sign in
FILE

core_kern.c

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/bpf/prog_tests/core_kern.c C
 1// SPDX-License-Identifier: GPL-2.0
 2/* Copyright (c) 2021 Facebook */
 3
 4#include "test_progs.h"
 5#include "core_kern.lskel.h"
 6
 7void test_core_kern_lskel(void)
 8{
 9	struct core_kern_lskel *skel;
10	int link_fd;
11
12	skel = core_kern_lskel__open_and_load();
13	if (!ASSERT_OK_PTR(skel, "open_and_load"))
14		return;
15
16	link_fd = core_kern_lskel__core_relo_proto__attach(skel);
17	if (!ASSERT_GT(link_fd, 0, "attach(core_relo_proto)"))
18		goto cleanup;
19
20	/* trigger tracepoints */
21	usleep(1);
22	ASSERT_TRUE(skel->bss->proto_out[0], "bpf_core_type_exists");
23	ASSERT_FALSE(skel->bss->proto_out[1], "!bpf_core_type_exists");
24	ASSERT_TRUE(skel->bss->proto_out[2], "bpf_core_type_exists. nested");
25
26cleanup:
27	core_kern_lskel__destroy(skel);
28}
~/ Read-only file preview.