1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2019 Facebook */
4 #include <test_progs.h>
9 } __attribute__((packed
));
11 #include "test_skeleton.skel.h"
13 void test_skeleton(void)
15 int duration
= 0, err
;
16 struct test_skeleton
* skel
;
17 struct test_skeleton__bss
*bss
;
18 struct test_skeleton__kconfig
*kcfg
;
20 skel
= test_skeleton__open();
21 if (CHECK(!skel
, "skel_open", "failed to open skeleton\n"))
24 if (CHECK(skel
->kconfig
, "skel_kconfig", "kconfig is mmaped()!\n"))
27 err
= test_skeleton__load(skel
);
28 if (CHECK(err
, "skel_load", "failed to load skeleton: %d\n", err
))
40 err
= test_skeleton__attach(skel
);
41 if (CHECK(err
, "skel_attach", "skeleton attach failed: %d\n", err
))
44 /* trigger tracepoint */
47 CHECK(bss
->out1
!= 1, "res1", "got %d != exp %d\n", bss
->out1
, 1);
48 CHECK(bss
->out2
!= 2, "res2", "got %lld != exp %d\n", bss
->out2
, 2);
49 CHECK(bss
->out3
!= 3, "res3", "got %d != exp %d\n", (int)bss
->out3
, 3);
50 CHECK(bss
->out4
!= 4, "res4", "got %lld != exp %d\n", bss
->out4
, 4);
51 CHECK(bss
->handler_out5
.a
!= 5, "res5", "got %d != exp %d\n",
52 bss
->handler_out5
.a
, 5);
53 CHECK(bss
->handler_out5
.b
!= 6, "res6", "got %lld != exp %d\n",
54 bss
->handler_out5
.b
, 6);
56 CHECK(bss
->bpf_syscall
!= kcfg
->CONFIG_BPF_SYSCALL
, "ext1",
57 "got %d != exp %d\n", bss
->bpf_syscall
, kcfg
->CONFIG_BPF_SYSCALL
);
58 CHECK(bss
->kern_ver
!= kcfg
->LINUX_KERNEL_VERSION
, "ext2",
59 "got %d != exp %d\n", bss
->kern_ver
, kcfg
->LINUX_KERNEL_VERSION
);
62 test_skeleton__destroy(skel
);