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:
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
@ -42,6 +42,7 @@ fork-f
|
||||
fstat
|
||||
fstat64
|
||||
fstatat64
|
||||
fsync
|
||||
ftruncate
|
||||
ftruncate64
|
||||
getcwd
|
||||
|
@ -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
27
tests/fsync.c
Normal 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
6
tests/fsync.test
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Check fsync syscall decoding.
|
||||
|
||||
. "${srcdir=.}/init.sh"
|
||||
run_strace_match_diff -a10
|
Reference in New Issue
Block a user