tests: add epoll_ctl.test
* tests/epoll_ctl.c: New file. * tests/epoll_ctl.test: New test. * tests/.gitignore: Add epoll_ctl. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add epoll_ctl.test.
This commit is contained in:
parent
bbdd23c8ed
commit
258a22519f
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -27,6 +27,7 @@ dup2
|
||||
dup3
|
||||
epoll_create
|
||||
epoll_create1
|
||||
epoll_ctl
|
||||
eventfd
|
||||
execve
|
||||
execve-v
|
||||
|
@ -78,6 +78,7 @@ check_PROGRAMS = \
|
||||
dup3 \
|
||||
epoll_create \
|
||||
epoll_create1 \
|
||||
epoll_ctl \
|
||||
eventfd \
|
||||
execve \
|
||||
execve-v \
|
||||
@ -278,6 +279,7 @@ DECODER_TESTS = \
|
||||
dup3.test \
|
||||
epoll_create.test \
|
||||
epoll_create1.test \
|
||||
epoll_ctl.test \
|
||||
eventfd.test \
|
||||
execve.test \
|
||||
execve-v.test \
|
||||
|
32
tests/epoll_ctl.c
Normal file
32
tests/epoll_ctl.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include "tests.h"
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#if defined __NR_epoll_ctl && defined HAVE_SYS_EPOLL_H
|
||||
|
||||
# include <errno.h>
|
||||
# include <inttypes.h>
|
||||
# include <stdio.h>
|
||||
# include <sys/epoll.h>
|
||||
# include <unistd.h>
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
struct epoll_event *const ev = tail_alloc(sizeof(*ev));
|
||||
ev->events = EPOLLIN;
|
||||
|
||||
int rc = syscall(__NR_epoll_ctl, -1, EPOLL_CTL_ADD, -2, ev);
|
||||
printf("epoll_ctl(-1, EPOLL_CTL_ADD, -2, {EPOLLIN,"
|
||||
" {u32=%u, u64=%" PRIu64 "}}) = %d %s (%m)\n",
|
||||
ev->data.u32, ev->data.u64, rc,
|
||||
errno == ENOSYS ? "ENOSYS" : "EBADF");
|
||||
|
||||
puts("+++ exited with 0 +++");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
SKIP_MAIN_UNDEFINED("__NR_epoll_ctl && HAVE_SYS_EPOLL_H")
|
||||
|
||||
#endif
|
6
tests/epoll_ctl.test
Executable file
6
tests/epoll_ctl.test
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Check epoll_ctl syscall decoding.
|
||||
|
||||
. "${srcdir=.}/init.sh"
|
||||
run_strace_match_diff
|
Loading…
Reference in New Issue
Block a user