]> granicus.if.org Git - strace/commitdiff
tests: add symlink.test
authorFei Jie <feij.fnst@cn.fujitsu.com>
Mon, 25 Apr 2016 08:18:23 +0000 (16:18 +0800)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 25 Apr 2016 10:24:48 +0000 (10:24 +0000)
* tests/symlink.c: New file.
* tests/symlink.test: New test.
* tests/.gitignore: Add symlink.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add symlink.test.

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

index b05c68ad9aa7c18e951a80d95385b46af6a7924f..ef39fe2016124e9425f0640857c4aaec84ef5b5e 100644 (file)
@@ -199,6 +199,7 @@ stat
 stat64
 statfs
 swap
+symlink
 symlinkat
 sync_file_range
 sync_file_range2
index 92d431048bbc3754f9c24e3d6b0a8e94860ee430..d23d0d8a5c7374383566bfc6b8322c26753b7e6f 100644 (file)
@@ -250,6 +250,7 @@ check_PROGRAMS = \
        stat64 \
        statfs \
        swap \
+       symlink \
        symlinkat \
        sync_file_range \
        sync_file_range2 \
@@ -498,6 +499,7 @@ DECODER_TESTS = \
        statfs.test \
        sun_path.test \
        swap.test \
+       symlink.test \
        symlinkat.test \
        sync_file_range.test \
        sync_file_range2.test \
diff --git a/tests/symlink.c b/tests/symlink.c
new file mode 100644 (file)
index 0000000..44c5655
--- /dev/null
@@ -0,0 +1,27 @@
+#include "tests.h"
+#include <sys/syscall.h>
+
+#ifdef __NR_symlink
+
+# include <stdio.h>
+# include <unistd.h>
+
+int
+main(void)
+{
+       static const char sample_1[] = "symlink_new";
+       static const char sample_2[] = "symlink";
+
+       long rc = syscall(__NR_symlink, sample_1, sample_2);
+       printf("symlink(\"%s\", \"%s\") = %ld %s (%m)\n",
+              sample_1, sample_2, rc, errno2name());
+
+       puts("+++ exited with 0 +++");
+       return 0;
+}
+
+#else
+
+SKIP_MAIN_UNDEFINED("__NR_symlink")
+
+#endif
diff --git a/tests/symlink.test b/tests/symlink.test
new file mode 100755 (executable)
index 0000000..79b93ba
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# Check symlink syscall decoding.
+
+. "${srcdir=.}/init.sh"
+run_strace_match_diff -a34