From: Fei Jie Date: Thu, 21 Apr 2016 07:53:50 +0000 (+0800) Subject: tests: add fchdir.test X-Git-Tag: v4.12~373 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e0057a578f25c8a5f611d0fb43d6b67fb8d80bf1;p=strace tests: add fchdir.test * tests/fchdir.c: New file. * tests/fchdir.test: New test. * tests/.gitignore: Add fchdir. * tests/Makefile.am (check_PROGRAMS): Likewise. (DECODER_TESTS): Add fchdir.test. --- diff --git a/tests/.gitignore b/tests/.gitignore index 237efa66..e33c0094 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -38,6 +38,7 @@ execveat execveat-v faccessat fanotify_mark +fchdir fchmod fchmodat fchown diff --git a/tests/Makefile.am b/tests/Makefile.am index 919630e3..08889a5d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -91,6 +91,7 @@ check_PROGRAMS = \ execveat-v \ faccessat \ fanotify_mark \ + fchdir \ fchmod \ fchmodat \ fchown \ @@ -340,6 +341,7 @@ DECODER_TESTS = \ execveat.test \ faccessat.test \ fanotify_mark.test \ + fchdir.test \ fchmod.test \ fchmodat.test \ fchown.test \ diff --git a/tests/fchdir.c b/tests/fchdir.c new file mode 100644 index 00000000..c9153a20 --- /dev/null +++ b/tests/fchdir.c @@ -0,0 +1,27 @@ +#include "tests.h" +#include + +#ifdef __NR_fchdir + +# include +# include +# include + +int +main(void) +{ + const long int fd = (long int) 0xdeadbeefffffffff; + + long rc = syscall(__NR_fchdir, fd); + printf("fchdir(%d) = %ld %s (%m)\n", + (int) fd, rc, errno == ENOSYS ? "ENOSYS" : "EBADF"); + + puts("+++ exited with 0 +++"); + return 0; +} + +#else + +SKIP_MAIN_UNDEFINED("__NR_fchdir") + +#endif diff --git a/tests/fchdir.test b/tests/fchdir.test new file mode 100755 index 00000000..3a4296ed --- /dev/null +++ b/tests/fchdir.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check fchdir syscall decoding. + +. "${srcdir=.}/init.sh" +run_strace_match_diff -a11