From: Fei Jie Date: Mon, 25 Apr 2016 08:18:23 +0000 (+0800) Subject: tests: add symlink.test X-Git-Tag: v4.12~290 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13c1d0899d05e3f3349629bf40c671b89044ecdd;p=strace tests: add symlink.test * 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. --- diff --git a/tests/.gitignore b/tests/.gitignore index b05c68ad..ef39fe20 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -199,6 +199,7 @@ stat stat64 statfs swap +symlink symlinkat sync_file_range sync_file_range2 diff --git a/tests/Makefile.am b/tests/Makefile.am index 92d43104..d23d0d8a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 00000000..44c5655b --- /dev/null +++ b/tests/symlink.c @@ -0,0 +1,27 @@ +#include "tests.h" +#include + +#ifdef __NR_symlink + +# include +# include + +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 index 00000000..79b93baa --- /dev/null +++ b/tests/symlink.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check symlink syscall decoding. + +. "${srcdir=.}/init.sh" +run_strace_match_diff -a34