tests: add fsync.test

* tests/fsync.c: New file.
* tests/fsync.test: New test.
* tests/.gitignore: Add fsync.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add fsync.test.
This commit is contained in:
Fei Jie
2016-03-31 16:06:50 +08:00
committed by Dmitry V. Levin
parent a067b8d3b0
commit 16c078ea99
4 changed files with 36 additions and 0 deletions

1
tests/.gitignore vendored
View File

@ -42,6 +42,7 @@ fork-f
fstat
fstat64
fstatat64
fsync
ftruncate
ftruncate64
getcwd

View File

@ -93,6 +93,7 @@ check_PROGRAMS = \
fstat \
fstat64 \
fstatat64 \
fsync \
ftruncate \
ftruncate64 \
getcwd \
@ -276,6 +277,7 @@ DECODER_TESTS = \
fstat.test \
fstat64.test \
fstatat64.test \
fsync.test \
ftruncate.test \
ftruncate64.test \
getcwd.test \

27
tests/fsync.c Normal file
View File

@ -0,0 +1,27 @@
#include "tests.h"
#include <sys/syscall.h>
#ifdef __NR_fsync
# include <errno.h>
# include <stdio.h>
# include <unistd.h>
int
main(void)
{
const long int fd = (long int) 0xdeadbeefffffffff;
int rc = syscall(__NR_fsync, fd);
printf("fsync(%d) = %d %s (%m)\n",
(int) fd, rc,
errno == ENOSYS ? "ENOSYS" : "EBADF");
puts("+++ exited with 0 +++");
return 0;
}
#else
SKIP_MAIN_UNDEFINED("__NR_fsync")
#endif

6
tests/fsync.test Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# Check fsync syscall decoding.
. "${srcdir=.}/init.sh"
run_strace_match_diff -a10