[PATCH 3/4] tests: add symlinkat.test
Dmitry V. Levin
ldv at altlinux.org
Wed Apr 20 01:43:09 UTC 2016
On Tue, Apr 19, 2016 at 03:38:34PM +0800, Fei Jie wrote:
> * 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 | 1 +
> tests/Makefile.am | 2 ++
> tests/symlinkat.c | 29 +++++++++++++++++++++++++++++
> tests/symlinkat.test | 6 ++++++
> 4 files changed, 38 insertions(+)
> create mode 100644 tests/symlinkat.c
> create mode 100755 tests/symlinkat.test
>
> diff --git a/tests/.gitignore b/tests/.gitignore
> index 31e39b4..fd5909b 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -155,6 +155,7 @@ stat
> stat64
> statfs
> swap
> +symlinkat
> sync_file_range
> sync_file_range2
> sysinfo
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 44bc44b..7231818 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -205,6 +205,7 @@ check_PROGRAMS = \
> stat64 \
> statfs \
> swap \
> + symlinkat \
> sync_file_range \
> sync_file_range2 \
> sysinfo \
> @@ -411,6 +412,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 0000000..5d1c032
> --- /dev/null
> +++ b/tests/symlinkat.c
> @@ -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";
> + int rc = syscall(__NR_symlinkat, oldpath, fd, newpath);
> + printf("symlinkat(\"%s\", %d, \"%s\") = %d %s (%m)\n",
> + oldpath, (int) fd, newpath, rc,
> + errno == ENOSYS ? "ENOSYS" : "EBADF");
> +
> + puts("+++ exited with 0 +++");
> + return 0;
> +}
Reindented and applied, thanks.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20160420/f5f9fc99/attachment.bin>
More information about the Strace-devel
mailing list