From e2975b61b386f64fa07f258d5cdedb129dcf4ff2 Mon Sep 17 00:00:00 2001 From: Fei Jie Date: Fri, 25 Mar 2016 17:47:15 +0800 Subject: [PATCH] tests: add faccessat.test * tests/faccessat.c: New file. * tests/faccessat.test: New test. * tests/.gitignore: Add faccessat. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add faccessat.test. --- tests/.gitignore | 1 + tests/Makefile.am | 2 ++ tests/faccessat.c | 29 +++++++++++++++++++++++++++++ tests/faccessat.test | 11 +++++++++++ 4 files changed, 43 insertions(+) create mode 100644 tests/faccessat.c create mode 100755 tests/faccessat.test diff --git a/tests/.gitignore b/tests/.gitignore index 21597617..ba3b8f5b 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -30,6 +30,7 @@ execve execve-v execveat execveat-v +faccessat fanotify_mark fchmod fcntl diff --git a/tests/Makefile.am b/tests/Makefile.am index 9e440096..a7e9d96a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -81,6 +81,7 @@ check_PROGRAMS = \ execve-v \ execveat \ execveat-v \ + faccessat \ fanotify_mark \ fchmod \ fcntl \ @@ -254,6 +255,7 @@ DECODER_TESTS = \ execve-v.test \ execveat.test \ execveat-v.test \ + faccessat.test \ fanotify_mark.test \ fchmod.test \ fcntl.test \ diff --git a/tests/faccessat.c b/tests/faccessat.c new file mode 100644 index 00000000..abf569f7 --- /dev/null +++ b/tests/faccessat.c @@ -0,0 +1,29 @@ +#include "tests.h" +#include + +#ifdef __NR_faccessat + +# include +# include +# include + +# define TMP_FILE "faccessat_tmpfile" + +int +main(void) +{ + const long int fd = (long int) 0xdeadbeefffffffff; + int rc = syscall(__NR_faccessat, fd, TMP_FILE, F_OK); + printf("faccessat(%d, \"%s\", F_OK) = %d %s (%m)\n", + (int) fd, TMP_FILE, rc, + errno == ENOSYS ? "ENOSYS" : "EBADF"); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_faccessat") + +#endif diff --git a/tests/faccessat.test b/tests/faccessat.test new file mode 100755 index 00000000..260497fd --- /dev/null +++ b/tests/faccessat.test @@ -0,0 +1,11 @@ +#!/bin/sh + +# Check faccessat syscall decoding. + +. "${srcdir=.}/init.sh" + +run_prog > /dev/null +OUT="$LOG.out" +run_strace -efaccessat $args > "$OUT" +match_diff "$LOG" "$OUT" +rm -f "$OUT" -- 2.40.0