[PATCH 3/4] tests: add epoll_wait.test

Fei Jie feij.fnst at cn.fujitsu.com
Fri Apr 8 07:59:16 UTC 2016


* 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>
+# include <unistd.h>
+
+int
+main(void)
+{
+	struct epoll_event *const ev = tail_alloc(sizeof(struct epoll_event));
+	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
diff --git a/tests/epoll_wait.test b/tests/epoll_wait.test
new file mode 100755
index 0000000..83ae161
--- /dev/null
+++ b/tests/epoll_wait.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check epoll_wait syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a26
-- 
1.8.3.1







More information about the Strace-devel mailing list