]> granicus.if.org Git - strace/commitdiff
tests: add fdatasync.test
authorFei Jie <feij.fnst@cn.fujitsu.com>
Thu, 31 Mar 2016 08:06:51 +0000 (16:06 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 1 Apr 2016 23:34:33 +0000 (23:34 +0000)
* 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
tests/Makefile.am
tests/fdatasync.c [new file with mode: 0644]
tests/fdatasync.test [new file with mode: 0755]

index 68236a8bf0ba67f43d3a31e13ab1b2fbf7894c8d..9ab1aaed7f882627ef6bc46daf10fbd86241a9ba 100644 (file)
@@ -35,6 +35,7 @@ fanotify_mark
 fchmod
 fcntl
 fcntl64
+fdatasync
 file_handle
 filter-unavailable
 flock
index 4d18fe6ebc20903edcdbc38ab972de578cefb2b8..da9727133e289072a33e2757d04a0037688084cf 100644 (file)
@@ -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 (file)
index 0000000..382f47d
--- /dev/null
@@ -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 (executable)
index 0000000..ff59749
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check fdatasync syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a14