[PATCH v3 3/3] This patch adds two test cases for the -z and -Z options.
Dmitry V. Levin
ldv at altlinux.org
Wed May 22 02:03:54 UTC 2019
On Thu, Apr 25, 2019 at 04:23:19PM +0200, burkhard.kohl at intel.com wrote:
> From: Burkhard Kohl <burkhard.kohl at intel.com>
>
> Signed-off-by: Burkhard Kohl <burkhard.kohl at intel.com>
> Co-Authored-by: Paul Chaignon <paul.chaignon at gmail.com>
> ---
> tests/.gitignore | 2 ++
> tests/Makefile.am | 2 ++
> tests/gen_tests.in | 2 ++
> tests/strace-Z.c | 40 ++++++++++++++++++++++++++++++++++++++++
> tests/strace-z.c | 40 ++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 86 insertions(+)
> create mode 100644 tests/strace-Z.c
> create mode 100644 tests/strace-z.c
>
> diff --git a/tests/.gitignore b/tests/.gitignore
> index 5a601641..25ad96b9 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -554,6 +554,8 @@ stat64
> statfs
> statfs64
> statx
> +strace-z
> +strace-Z
> swap
> sxetmask
> symlink
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 9e99aff2..633a12e2 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -157,6 +157,8 @@ check_PROGRAMS = $(PURE_EXECUTABLES) \
> sleep \
> stack-fcall \
> stack-fcall-mangled \
> + strace-z \
> + strace-Z \
> threads-execve \
> unblock_reset_raise \
> unix-pair-send-recv \
> diff --git a/tests/gen_tests.in b/tests/gen_tests.in
> index 314608eb..a8eb794e 100644
> --- a/tests/gen_tests.in
> +++ b/tests/gen_tests.in
> @@ -461,6 +461,8 @@ stat64 -a32 -v -P stat.sample -P /dev/full
> statfs -a17
> statfs64 -a23
> statx -a32 -v -P stat.sample -P /dev/full
> +strace-z -a12 -e trace=chdir -P .. -z
> +strace-Z -a18 -e trace=chdir -P /dev/nil -Z
For the purpose of these tests you can safely assume that
chdir(".") does not fail and chdir("") does fail,
so there is no need for -P because
-e trace=chdir -z is expected to print chdir("."), and
-e trace=chdir -Z is expected to print chdir("");
> swap -a23 -e trace=swapon,swapoff
> sxetmask -a11 -e trace=sgetmask,ssetmask
> symlink -a34
> diff --git a/tests/strace-Z.c b/tests/strace-Z.c
> new file mode 100644
> index 00000000..12d7fedc
> --- /dev/null
> +++ b/tests/strace-Z.c
> @@ -0,0 +1,40 @@
> +/*
> + * Copyright (c) 2019 Intel Corporation
> + * Copyright (c) 2019 Paul Chaignon <paul.chaignon at gmail.com>
> + * All rights reserved.
> + *
> + * SPDX-License-Identifier: LGPL-2.1-or-later
> + */
> +
> +#include "tests.h"
> +#include <asm/unistd.h>
> +
> +#ifdef __NR_chdir
You can safely assume that __NR_chdir is universally available.
In fact, you can simply use chdir() function provided by libc.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20190522/a4df936d/attachment.bin>
More information about the Strace-devel
mailing list