]> granicus.if.org Git - strace/commitdiff
tests: add fchdir.test
authorFei Jie <feij.fnst@cn.fujitsu.com>
Thu, 21 Apr 2016 07:53:50 +0000 (15:53 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 21 Apr 2016 17:35:39 +0000 (17:35 +0000)
* 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.

tests/.gitignore
tests/Makefile.am
tests/fchdir.c [new file with mode: 0644]
tests/fchdir.test [new file with mode: 0755]

index 237efa663fc6202f7b569fd30c78288aa0ed4355..e33c0094487b20d0c20cf0736254edeb01507f92 100644 (file)
@@ -38,6 +38,7 @@ execveat
 execveat-v
 faccessat
 fanotify_mark
+fchdir
 fchmod
 fchmodat
 fchown
index 919630e372574561be103397c2fa4f4f9f0ca1fa..08889a5dc119433dfda75ba59261cbd00fcf58bf 100644 (file)
@@ -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 (file)
index 0000000..c9153a2
--- /dev/null
@@ -0,0 +1,27 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_fchdir
+
+# include <errno.h>
+# include <stdio.h>
+# include <unistd.h>
+
+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 (executable)
index 0000000..3a4296e
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check fchdir syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a11