]> granicus.if.org Git - strace/commitdiff
tests: add symlinkat.test
authorFei Jie <feij.fnst@cn.fujitsu.com>
Tue, 19 Apr 2016 07:38:34 +0000 (15:38 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 20 Apr 2016 01:08:13 +0000 (01:08 +0000)
* tests/symlinkat.c: New file.
* tests/symlinkat.test: New test.
* tests/.gitignore: Add symlinkat.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add symlinkat.test.

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

index 1b2a422b0b0954d5e2a143f82cdd21c2f6a45445..87ef8a925c2683cb5efb5944cd46cae9c46893fa 100644 (file)
@@ -177,6 +177,7 @@ stat
 stat64
 statfs
 swap
+symlinkat
 sync_file_range
 sync_file_range2
 sysinfo
index 8be33758dc34e3a14b1e86c712001e1cc8fcdaad..6f515dafe3feb65589ab2e893033f4d82a10400a 100644 (file)
@@ -227,6 +227,7 @@ check_PROGRAMS = \
        stat64 \
        statfs \
        swap \
+       symlinkat \
        sync_file_range \
        sync_file_range2 \
        sysinfo \
@@ -455,6 +456,7 @@ DECODER_TESTS = \
        statfs.test \
        sun_path.test \
        swap.test \
+       symlinkat.test \
        sync_file_range.test \
        sync_file_range2.test \
        sysinfo.test \
diff --git a/tests/symlinkat.c b/tests/symlinkat.c
new file mode 100644 (file)
index 0000000..37d055a
--- /dev/null
@@ -0,0 +1,29 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_symlinkat
+
+# include <errno.h>
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+       const long int fd = (long int) 0xdeadbeefffffffff;
+       static const char oldpath[] = "symlink_old";
+       static const char newpath[] = "symlink_new";
+       long rc = syscall(__NR_symlinkat, oldpath, fd, newpath);
+       printf("symlinkat(\"%s\", %d, \"%s\") = %ld %s (%m)\n",
+              oldpath, (int) fd, newpath, rc,
+              errno == ENOSYS ? "ENOSYS" : "EBADF");
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_symlinkat")
+
+#endif
diff --git a/tests/symlinkat.test b/tests/symlinkat.test
new file mode 100755 (executable)
index 0000000..d8501ff
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check symlinkat syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff