[PATCH 3/4] tests: add epoll_wait.test
Dmitry V. Levin
ldv at altlinux.org
Sun Apr 10 00:33:20 UTC 2016
On Fri, Apr 08, 2016 at 03:59:16PM +0800, Fei Jie wrote:
> * tests/epoll_wait.c: New file.
> * tests/epoll_wait.test: New test.
> * tests/.gitignore: Add epoll_wait.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (DECODER_TESTS): Add epoll_wait.test.
> ---
> tests/.gitignore | 1 +
> tests/Makefile.am | 2 ++
> tests/epoll_wait.c | 27 +++++++++++++++++++++++++++
> tests/epoll_wait.test | 6 ++++++
> 4 files changed, 36 insertions(+)
> create mode 100644 tests/epoll_wait.c
> create mode 100755 tests/epoll_wait.test
>
> diff --git a/tests/.gitignore b/tests/.gitignore
> index 849d6ef..9ef0c03 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -28,6 +28,7 @@ dup3
> epoll_create
> epoll_create1
> epoll_ctl
> +epoll_wait
> eventfd
> execve
> execve-v
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 2a761d8..7cd3991 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -79,6 +79,7 @@ check_PROGRAMS = \
> epoll_create \
> epoll_create1 \
> epoll_ctl \
> + epoll_wait \
> eventfd \
> execve \
> execve-v \
> @@ -280,6 +281,7 @@ DECODER_TESTS = \
> epoll_create.test \
> epoll_create1.test \
> epoll_ctl.test \
> + epoll_wait.test \
> eventfd.test \
> execve.test \
> execve-v.test \
> diff --git a/tests/epoll_wait.c b/tests/epoll_wait.c
> new file mode 100644
> index 0000000..2edcb7c
> --- /dev/null
> +++ b/tests/epoll_wait.c
> @@ -0,0 +1,27 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#ifdef __NR_epoll_wait
> +
> +# include <errno.h>
> +# include <stdio.h>
> +# include <sys/epoll.h>
Inclusion of <sys/epoll.h> has to be guarded with HAVE_SYS_EPOLL_H.
> +# include <unistd.h>
> +
> +int
> +main(void)
> +{
> + struct epoll_event *const ev = tail_alloc(sizeof(struct epoll_event));
sizeof(struct epoll_event) can be replaced with sizeof(*ev).
> + int rc = syscall(__NR_epoll_wait, -1, ev, 1, 0);
> + printf("epoll_wait(-1, %p, 1, 0) = %d %s (%m)\n",
> + ev, rc, errno == ENOSYS ? "ENOSYS" : "EBADF");
> +
> + puts("+++ exited with 0 +++");
> + return 0;
> +}
> +
> +#else
> +
> +SKIP_MAIN_UNDEFINED("__NR_epoll_wait")
> +
> +#endif
Applied with these editions.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160410/ef47d61b/attachment.bin>
More information about the Strace-devel
mailing list