From: Dmitry V. Levin Date: Fri, 18 Sep 2015 21:20:56 +0000 (+0000) Subject: tests: add one more case to pselect6.test X-Git-Tag: v4.11~170 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81ea4bf063ce5a33bd68949ccf65e7d9259096aa;p=strace tests: add one more case to pselect6.test * tests/pselect6.c (main): Check how timeout is printed on exiting syscall. --- diff --git a/tests/pselect6.c b/tests/pselect6.c index 532fb83b..34af19e0 100644 --- a/tests/pselect6.c +++ b/tests/pselect6.c @@ -55,10 +55,10 @@ int main(int ac, char **av) struct { struct timespec ts; int pad[2]; - } tm = { - .ts = { .tv_nsec = 123 }, + } tm_in = { + .ts = { .tv_sec = 0xc0de1, .tv_nsec = 0xc0de2 }, .pad = { 0xdeadbeef, 0xbadc0ded } - }; + }, tm = tm_in; sigset_t mask; const struct sigaction act = { .sa_handler = handler }; const struct itimerval itv = { .it_value.tv_usec = 111111 }; @@ -87,6 +87,22 @@ int main(int ac, char **av) fds[0], fds[1], NSIG / 8, fds[1]); + /* + * Another simple one, with a timeout. + */ + FD_SET(1, set[1]); + FD_SET(2, set[1]); + FD_SET(fds[0], set[1]); + FD_SET(fds[1], set[1]); + if (syscall(__NR_pselect6, fds[1] + 1, NULL, set[1], NULL, &tm.ts, NULL) != 3) + return 77; + printf("pselect6(%d, NULL, [1 2 %d %d], NULL, {%Ld, %Ld}, NULL)" + " = 3 (out [1 2 %d], left {%Ld, %Ld})\n", + fds[1] + 1, fds[0], fds[1], + (long long) tm_in.ts.tv_sec, (long long) tm_in.ts.tv_nsec, + fds[1], + (long long) tm.ts.tv_sec, (long long) tm.ts.tv_nsec); + /* * Now the crash case that trinity found, negative nfds * but with a pointer to a large chunk of valid memory. @@ -104,6 +120,8 @@ int main(int ac, char **av) FD_ZERO(set[0]); FD_SET(fds[0],set[0]); FD_ZERO(set[1]); + tm.ts.tv_sec = 0; + tm.ts.tv_nsec = 123; if (pselect(FD_SETSIZE + 1, set[0], set[1], NULL, &tm.ts, &mask) != 0) return 77; printf("pselect6(%d, [%d], [], NULL, {0, 123}, {[HUP CHLD], %u}) "