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

Fei Jie feij.fnst at cn.fujitsu.com
Thu Mar 31 08:06:51 UTC 2016


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

diff --git a/tests/.gitignore b/tests/.gitignore
index 68236a8..9ab1aae 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -35,6 +35,7 @@ fanotify_mark
 fchmod
 fcntl
 fcntl64
+fdatasync
 file_handle
 filter-unavailable
 flock
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4d18fe6..da97271 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -86,6 +86,7 @@ check_PROGRAMS = \
 	fchmod \
 	fcntl \
 	fcntl64 \
+	fdatasync \
 	file_handle \
 	filter-unavailable \
 	flock \
@@ -272,6 +273,7 @@ DECODER_TESTS = \
 	fchmod.test \
 	fcntl.test \
 	fcntl64.test \
+	fdatasync.test \
 	file_handle.test \
 	flock.test \
 	fstat.test \
diff --git a/tests/fdatasync.c b/tests/fdatasync.c
new file mode 100644
index 0000000..382f47d
--- /dev/null
+++ b/tests/fdatasync.c
@@ -0,0 +1,27 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_fdatasync
+
+# include <errno.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+	const long int fd = (long int) 0xdeadbeefffffffff;
+	int rc = syscall(__NR_fdatasync, fd);
+	printf("fdatasync(%d) = %d %s (%m)\n",
+	       (int) fd, rc,
+	       errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+	puts("+++ exited with 0 +++");
+	return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_fdatasync")
+
+#endif
diff --git a/tests/fdatasync.test b/tests/fdatasync.test
new file mode 100755
index 0000000..ff59749
--- /dev/null
+++ b/tests/fdatasync.test
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check fdatasync syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a14
-- 
1.8.3.1







More information about the Strace-devel mailing list