[PATCH 1/4] tests: add epoll_create.test

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


* tests/epoll_create.c: New file.
* tests/epoll_create.test: New test.
* tests/.gitignore: Add epoll_create.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add epoll_create.test.
---
 tests/.gitignore        |  1 +
 tests/Makefile.am       |  2 ++
 tests/epoll_create.c    | 26 ++++++++++++++++++++++++++
 tests/epoll_create.test |  6 ++++++
 4 files changed, 35 insertions(+)
 create mode 100644 tests/epoll_create.c
 create mode 100755 tests/epoll_create.test

diff --git a/tests/.gitignore b/tests/.gitignore
index ea67040..0478e18 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -25,6 +25,7 @@ creat
 dup
 dup2
 dup3
+epoll_create
 epoll_create1
 eventfd
 execve
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3d0b5d1..8dc6673 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -76,6 +76,7 @@ check_PROGRAMS = \
 	dup \
 	dup2 \
 	dup3 \
+	epoll_create \
 	epoll_create1 \
 	eventfd \
 	execve \
@@ -275,6 +276,7 @@ DECODER_TESTS = \
 	dup.test \
 	dup2.test \
 	dup3.test \
+	epoll_create.test \
 	epoll_create1.test \
 	eventfd.test \
 	execve.test \
diff --git a/tests/epoll_create.c b/tests/epoll_create.c
new file mode 100644
index 0000000..5300825
--- /dev/null
+++ b/tests/epoll_create.c
@@ -0,0 +1,26 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#if defined __NR_epoll_create
+
+# include <errno.h>
+# include <stdio.h>
+# include <unistd.h>
+# include <sys/epoll.h>
+
+int
+main(void)
+{
+	int rc = syscall(__NR_epoll_create, -1);
+	printf("epoll_create(-1) = %d %s (%m)\n",
+	       rc, errno == ENOSYS ? "ENOSYS" : "EINVAL");
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_epoll_creat")
+
+#endif
diff --git a/tests/epoll_create.test b/tests/epoll_create.test
new file mode 100755
index 0000000..472a9bd
--- /dev/null
+++ b/tests/epoll_create.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check epoll_create syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a17
-- 
1.8.3.1







More information about the Strace-devel mailing list