X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Fkernel%2Fselect_poll_epoll.c;h=3c9a4b15d0b8aea3c86dc0cd5ef9b59c55d98307;hp=33b8cb5d5d100d29ac18777ba68ae996e1ced057;hb=f12eb9c1ceb619db54be0842323a32cda12651cd;hpb=938bd42282f0ba31bf22ad23b0bd3e04e848e052 diff --git a/tests/regression/kernel/select_poll_epoll.c b/tests/regression/kernel/select_poll_epoll.c index 33b8cb5d5..3c9a4b15d 100644 --- a/tests/regression/kernel/select_poll_epoll.c +++ b/tests/regression/kernel/select_poll_epoll.c @@ -46,6 +46,7 @@ struct ppoll_thread_data { int value; }; +static void test_select_big(void) { fd_set rfds, wfds, exfds; @@ -95,6 +96,7 @@ end: return; } +static void test_pselect(void) { fd_set rfds; @@ -128,6 +130,7 @@ void test_pselect(void) } +static void test_select(void) { fd_set rfds; @@ -161,6 +164,7 @@ void test_select(void) } +static void test_poll(void) { struct pollfd ufds[NB_FD]; @@ -185,6 +189,7 @@ void test_poll(void) } } +static void test_ppoll(void) { struct pollfd ufds[NB_FD]; @@ -217,6 +222,7 @@ void test_ppoll(void) } } +static void test_ppoll_big(void) { struct pollfd ufds[MAX_FDS]; @@ -256,6 +262,7 @@ void test_ppoll_big(void) return; } +static void test_epoll(void) { int ret, epollfd; @@ -298,6 +305,7 @@ end: return; } +static void test_pepoll(void) { int ret, epollfd; @@ -340,6 +348,7 @@ end: return; } +static void run_working_cases(void) { int ret; @@ -386,6 +395,7 @@ end: * segfault (eventually with a "*** stack smashing detected ***" message). * The event should contain an array of 100 FDs filled with garbage. */ +static void ppoll_fds_buffer_overflow(void) { struct pollfd ufds[NB_FD]; @@ -417,6 +427,7 @@ void ppoll_fds_buffer_overflow(void) * cleanly fail with a "Invalid argument". * The event should contain an empty array of FDs and overflow = 1. */ +static void ppoll_fds_ulong_max(void) { struct pollfd ufds[NB_FD]; @@ -447,6 +458,7 @@ void ppoll_fds_ulong_max(void) * Pass an invalid file descriptor to pselect6(). The syscall should return * -EBADF. The recorded event should contain a "ret = -EBADF (-9)". */ +static void pselect_invalid_fd(void) { fd_set rfds; @@ -493,6 +505,7 @@ error: * Invalid pointer as writefds, should output a ppoll event * with 0 FDs. */ +static void pselect_invalid_pointer(void) { fd_set rfds; @@ -524,6 +537,7 @@ void pselect_invalid_pointer(void) * Pass an invalid pointer to epoll_pwait, should fail with * "Bad address", the event returns 0 FDs. */ +static void epoll_pwait_invalid_pointer(void) { int ret, epollfd; @@ -568,6 +582,7 @@ end: * Set maxevents to INT_MAX, should output "Invalid argument" * The event should return an empty array. */ +static void epoll_pwait_int_max(void) { int ret, epollfd; @@ -607,6 +622,7 @@ end: return; } +static void *ppoll_writer(void *arg) { struct ppoll_thread_data *data = (struct ppoll_thread_data *) arg; @@ -620,6 +636,7 @@ void *ppoll_writer(void *arg) return NULL; } +static void do_ppoll(int *fds, struct pollfd *ufds) { int i, ret; @@ -649,6 +666,7 @@ void do_ppoll(int *fds, struct pollfd *ufds) } } +static void stress_ppoll(int *fds, int value) { pthread_t writer; @@ -690,6 +708,7 @@ end: * * ppoll should work as expected and the trace should be readable at the end. */ +static void ppoll_concurrent_write(void) { int i, ret, fds[MAX_FDS]; @@ -715,6 +734,7 @@ void ppoll_concurrent_write(void) return; } +static void *epoll_pwait_writer(void *addr) { srand(time(NULL)); @@ -732,6 +752,7 @@ void *epoll_pwait_writer(void *addr) * buffer allocated for the returned data. This should randomly segfault. * The trace should be readable and no kernel OOPS should occur. */ +static void epoll_pwait_concurrent_munmap(void) { int ret, epollfd, i, fds[MAX_FDS]; @@ -814,15 +835,7 @@ end: return; } -void usage(poptContext optCon, int exitcode, char *error, char *addl) -{ - poptPrintUsage(optCon, stderr, 0); - if (error) { - fprintf(stderr, "%s: %s\n", error, addl); - } - exit(exitcode); -} - +static void print_list(void) { fprintf(stderr, "Test list (-t X):\n");