0001
0002
0003
0004 #include <test_progs.h>
0005 #include <time.h>
0006 #include "test_vmlinux.skel.h"
0007
0008 #define MY_TV_NSEC 1337
0009
0010 static void nsleep()
0011 {
0012 struct timespec ts = { .tv_nsec = MY_TV_NSEC };
0013
0014 (void)syscall(__NR_nanosleep, &ts, NULL);
0015 }
0016
0017 void test_vmlinux(void)
0018 {
0019 int duration = 0, err;
0020 struct test_vmlinux* skel;
0021 struct test_vmlinux__bss *bss;
0022
0023 skel = test_vmlinux__open_and_load();
0024 if (CHECK(!skel, "skel_open", "failed to open skeleton\n"))
0025 return;
0026 bss = skel->bss;
0027
0028 err = test_vmlinux__attach(skel);
0029 if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err))
0030 goto cleanup;
0031
0032
0033 nsleep();
0034
0035 CHECK(!bss->tp_called, "tp", "not called\n");
0036 CHECK(!bss->raw_tp_called, "raw_tp", "not called\n");
0037 CHECK(!bss->tp_btf_called, "tp_btf", "not called\n");
0038 CHECK(!bss->kprobe_called, "kprobe", "not called\n");
0039 CHECK(!bss->fentry_called, "fentry", "not called\n");
0040
0041 cleanup:
0042 test_vmlinux__destroy(skel);
0043 }