0001
0002
0003
0004 #include <test_progs.h>
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "exhandler_kern.skel.h"
0017
0018 void test_exhandler(void)
0019 {
0020 int err = 0, duration = 0, status;
0021 struct exhandler_kern *skel;
0022 pid_t cpid;
0023
0024 skel = exhandler_kern__open_and_load();
0025 if (CHECK(!skel, "skel_load", "skeleton failed: %d\n", err))
0026 goto cleanup;
0027
0028 skel->bss->test_pid = getpid();
0029
0030 err = exhandler_kern__attach(skel);
0031 if (!ASSERT_OK(err, "attach"))
0032 goto cleanup;
0033 cpid = fork();
0034 if (!ASSERT_GT(cpid, -1, "fork failed"))
0035 goto cleanup;
0036 if (cpid == 0)
0037 _exit(0);
0038 waitpid(cpid, &status, 0);
0039
0040 ASSERT_NEQ(skel->bss->exception_triggered, 0, "verify exceptions occurred");
0041 cleanup:
0042 exhandler_kern__destroy(skel);
0043 }