[PATCH 2/4] tests: add unlinkat.test

Dmitry V. Levin ldv at altlinux.org
Thu Apr 7 01:54:41 UTC 2016


On Wed, Apr 06, 2016 at 02:18:49PM +0800, Fei Jie wrote:
> * tests/unlinkat.c: New file.
> * tests/unlinkat.test: New test.
> * tests/.gitignore: Add unlinkat.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (DECODER_TESTS): Add unlinkat.test.
> ---
>  tests/.gitignore    |  1 +
>  tests/Makefile.am   |  2 ++
>  tests/unlinkat.c    | 28 ++++++++++++++++++++++++++++
>  tests/unlinkat.test |  6 ++++++
>  4 files changed, 37 insertions(+)
>  create mode 100644 tests/unlinkat.c
>  create mode 100755 tests/unlinkat.test
> 
> diff --git a/tests/.gitignore b/tests/.gitignore
> index 85a3491..9ebab08 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -160,6 +160,7 @@ umount2
>  umovestr
>  umovestr2
>  uname
> +unlinkat
>  unix-pair-send-recv
>  userfaultfd
>  utime
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index e03b619..651ebb0 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -209,6 +209,7 @@ check_PROGRAMS = \
>  	umovestr \
>  	umovestr2 \
>  	uname \
> +	unlinkat \
>  	unix-pair-send-recv \
>  	userfaultfd \
>  	utime \
> @@ -396,6 +397,7 @@ DECODER_TESTS = \
>  	umovestr.test \
>  	umovestr2.test \
>  	uname.test \
> +	unlinkat.test \
>  	userfaultfd.test \
>  	utime.test \
>  	utimensat.test \
> diff --git a/tests/unlinkat.c b/tests/unlinkat.c
> new file mode 100644
> index 0000000..bf59c0e
> --- /dev/null
> +++ b/tests/unlinkat.c
> @@ -0,0 +1,28 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#ifdef __NR_unlinkat
> +
> +# include <errno.h>
> +# include <stdio.h>
> +# include <unistd.h>
> +
> +int
> +main(void)
> +{
> +	static const char sample[] = "unlinkat_sample";
> +	const long int fd = (long int) 0xdeadbeefffffffff;
> +	int rc = syscall(__NR_unlinkat, fd, sample, 0);
> +	printf("unlinkat(%d, \"%s\", 0) = %d %s (%m)\n",
> +	       (int) fd, sample, rc,
> +	       errno == ENOSYS ? "ENOSYS" : "EBADF");
> +
> +	puts("+++ exited with 0 +++");
> +	return 0;
> +}
> +
> +#else
> +
> +SKIP_MAIN_UNDEFINED("__NR_unlinkat")
> +
> +#endif
> diff --git a/tests/unlinkat.test b/tests/unlinkat.test
> new file mode 100755
> index 0000000..864261f
> --- /dev/null
> +++ b/tests/unlinkat.test
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +
> +# Check unlinkat syscall decoding.
> +
> +. "${srcdir=.}/init.sh"
> +run_strace_match_diff -a35

Applied, thanks.
Also I've added a check for unlinkat AT_* decoding in a separate commit.


-- 
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/20160407/c29b7f80/attachment.bin>


More information about the Strace-devel mailing list