From: Fei Jie Date: Tue, 19 Apr 2016 07:38:34 +0000 (+0800) Subject: tests: add symlinkat.test X-Git-Tag: v4.12~391 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bff70d431190428f60f4a654d2824f367ffd7353;p=strace tests: add symlinkat.test * 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. --- diff --git a/tests/.gitignore b/tests/.gitignore index 1b2a422b..87ef8a92 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -177,6 +177,7 @@ stat stat64 statfs swap +symlinkat sync_file_range sync_file_range2 sysinfo diff --git a/tests/Makefile.am b/tests/Makefile.am index 8be33758..6f515daf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 index 00000000..37d055aa --- /dev/null +++ b/tests/symlinkat.c @@ -0,0 +1,29 @@ +#include "tests.h" +#include + +#ifdef __NR_symlinkat + +# include +# include +# include + +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 index 00000000..d8501ffd --- /dev/null +++ b/tests/symlinkat.test @@ -0,0 +1,6 @@ +#!/bin/sh + +# Check symlinkat syscall decoding. + +. "${srcdir=.}/init.sh" +run_strace_match_diff