From e3086cbc4dec5343d34d4ffd2694cb0de49c2773 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 9 May 2016 22:11:24 +0000 Subject: [PATCH] tests: check decoding of epoll_pwait syscall * tests/epoll_pwait.c: New file. * tests/epoll_pwait.test: New test. * tests/.gitignore: Add epoll_pwait. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add epoll_pwait.test. --- tests/.gitignore | 1 + tests/Makefile.am | 2 ++ tests/epoll_pwait.c | 29 +++++++++++++++++++++++++++++ tests/epoll_pwait.test | 6 ++++++ 4 files changed, 38 insertions(+) create mode 100644 tests/epoll_pwait.c create mode 100755 tests/epoll_pwait.test diff --git a/tests/.gitignore b/tests/.gitignore index 102d8edd..1fa92390 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -32,6 +32,7 @@ dup3 epoll_create epoll_create1 epoll_ctl +epoll_pwait epoll_wait eventfd execve diff --git a/tests/Makefile.am b/tests/Makefile.am index c09701dc..a7b09592 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -87,6 +87,7 @@ check_PROGRAMS = \ epoll_create \ epoll_create1 \ epoll_ctl \ + epoll_pwait \ epoll_wait \ eventfd \ execve \ @@ -369,6 +370,7 @@ DECODER_TESTS = \ epoll_create.test \ epoll_create1.test \ epoll_ctl.test \ + epoll_pwait.test \ epoll_wait.test \ eventfd.test \ execve-v.test \ diff --git a/tests/epoll_pwait.c b/tests/epoll_pwait.c new file mode 100644 index 00000000..a307e849 --- /dev/null +++ b/tests/epoll_pwait.c @@ -0,0 +1,29 @@ +#include "tests.h" +#include + +#ifdef __NR_epoll_pwait + +# include +# include +# include +# include + +int +main(void) +{ + sigset_t set[2]; + struct epoll_event *const ev = tail_alloc(sizeof(*ev)); + + long rc = syscall(__NR_epoll_pwait, -1, ev, 1, -2, set, sizeof(set)); + printf("epoll_pwait(-1, %p, 1, -2, %p, %u) = %ld %s (%m)\n", + ev, set, (unsigned) sizeof(set), rc, errno2name()); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_epoll_pwait") + +#endif diff --git a/tests/epoll_pwait.test b/tests/epoll_pwait.test new file mode 100755 index 00000000..c7aeeace --- /dev/null +++ b/tests/epoll_pwait.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check decoding of epoll_pwait syscall. + +. "${srcdir=.}/init.sh" +run_strace_match_diff -- 2.40.0