]> Git Repo - J-linux.git/blob - tools/testing/selftests/bpf/prog_tests/prog_array_init.c
Merge drm/drm-next into drm-intel-gt-next
[J-linux.git] / tools / testing / selftests / bpf / prog_tests / prog_array_init.c
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (c) 2021 Hengqi Chen */
3
4 #include <test_progs.h>
5 #include "test_prog_array_init.skel.h"
6
7 void test_prog_array_init(void)
8 {
9         struct test_prog_array_init *skel;
10         int err;
11
12         skel = test_prog_array_init__open();
13         if (!ASSERT_OK_PTR(skel, "could not open BPF object"))
14                 return;
15
16         skel->rodata->my_pid = getpid();
17
18         err = test_prog_array_init__load(skel);
19         if (!ASSERT_OK(err, "could not load BPF object"))
20                 goto cleanup;
21
22         skel->links.entry = bpf_program__attach_raw_tracepoint(skel->progs.entry, "sys_enter");
23         if (!ASSERT_OK_PTR(skel->links.entry, "could not attach BPF program"))
24                 goto cleanup;
25
26         usleep(1);
27
28         ASSERT_EQ(skel->bss->value, 42, "unexpected value");
29
30 cleanup:
31         test_prog_array_init__destroy(skel);
32 }
This page took 0.032925 seconds and 4 git commands to generate.