Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
3aae4a3
Breadcrumbs
linux
/
tools
/
testing
/
selftests
/
bpf
/
prog_tests
/
snprintf_btf.c
Blame
Blame
Latest commit
History
History
60 lines (49 loc) · 1.52 KB
Breadcrumbs
linux
/
tools
/
testing
/
selftests
/
bpf
/
prog_tests
/
snprintf_btf.c
Top
File metadata and controls
Code
Blame
60 lines (49 loc) · 1.52 KB
Raw
// SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> #include <linux/btf.h> #include "netif_receive_skb.skel.h" /* Demonstrate that bpf_snprintf_btf succeeds and that various data types * are formatted correctly. */ void test_snprintf_btf(void) { struct netif_receive_skb *skel; struct netif_receive_skb__bss *bss; int err, duration = 0; skel = netif_receive_skb__open(); if (CHECK(!skel, "skel_open", "failed to open skeleton\n")) return; err = netif_receive_skb__load(skel); if (CHECK(err, "skel_load", "failed to load skeleton: %d\n", err)) goto cleanup; bss = skel->bss; err = netif_receive_skb__attach(skel); if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err)) goto cleanup; /* generate receive event */ (void) system("ping -c 1 127.0.0.1 > /dev/null"); if (bss->skip) { printf("%s:SKIP:no __builtin_btf_type_id\n", __func__); test__skip(); goto cleanup; } /* * Make sure netif_receive_skb program was triggered * and it set expected return values from bpf_trace_printk()s * and all tests ran. */ if (CHECK(bss->ret <= 0, "bpf_snprintf_btf: got return value", "ret <= 0 %ld test %d\n", bss->ret, bss->ran_subtests)) goto cleanup; if (CHECK(bss->ran_subtests == 0, "check if subtests ran", "no subtests ran, did BPF program run?")) goto cleanup; if (CHECK(bss->num_subtests != bss->ran_subtests, "check all subtests ran", "only ran %d of %d tests\n", bss->num_subtests, bss->ran_subtests)) goto cleanup; cleanup: netif_receive_skb__destroy(skel); }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
You can’t perform that action at this time.