From: Fei Jie Date: Thu, 31 Mar 2016 08:06:51 +0000 (+0800) Subject: tests: add fdatasync.test X-Git-Tag: v4.12~462 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c4ab0fe823ff20e4076e50dd9ef9a1ab1da0199;p=strace 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 68236a8b..9ab1aaed 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 4d18fe6e..da972713 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 00000000..382f47da --- /dev/null +++ b/tests/fdatasync.c @@ -0,0 +1,27 @@ +#include "tests.h" +#include + +#ifdef __NR_fdatasync + +# include +# include +# include + +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 00000000..ff59749f --- /dev/null +++ b/tests/fdatasync.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check fdatasync syscall decoding. + +. "${srcdir=.}/init.sh" +run_strace_match_diff -a14