tests: add fdatasync.test

* 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.
diff --git a/tests/.gitignore b/tests/.gitignore
index 68236a8..9ab1aae 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -35,6 +35,7 @@
 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 @@
 	fchmod \
 	fcntl \
 	fcntl64 \
+	fdatasync \
 	file_handle \
 	filter-unavailable \
 	flock \
@@ -272,6 +273,7 @@
 	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