[PATCH v5 4/4] tests: check status qualifier

Dmitry V. Levin ldv at altlinux.org
Mon Jul 1 23:40:54 UTC 2019


On Fri, Jun 28, 2019 at 11:34:40AM +0200, Paul Chaignon wrote:
> This patch adds 6 test cases for -e status with unfinished, failed, none,
> successful, detached, and the whole set.  The test cases for failed,
> successful, and the whole set use chdir(2).  The test cases for unfinished
> and none rely on a child thread execve'ing the lead thread.  The test case
> for detached interrupts strace while attached to a sleeping process.
> 
> * tests/status-all.c: New test.
> * tests/status-detached.test: New test.
> * tests/status-detached.expected: New file.
> * tests/status-failed.c: New test.
> * tests/status-none.c: New test.
> * tests/status-successful.c: New test.
> * tests/status-unfinished.c: New test.
> * tests/status.c: New file.
> * tests/tests.h (test_status_chdir): New prototype.
> * tests/.gitignore: Add status-all, status-failed, status-none,
> status-successful, and status-unfinished.
> * tests/gen_tests.in: Likewise.
> * tests/pure_executables.list: Likewise.
> * tests/Makefile.am: Add status.c, status_none_LDADD,
> status_unfinished_LDADD, and status-detached.test.

* tests/Makefile.am (libtests_a_SOURCES): Add status.c.
(status_none_LDADD, status_unfinished_LDADD): New variables.
(MISC_TESTS): Add status-detached.test.
(EXTRA_DIST): Add status-detached.expected.

[...]
> --- /dev/null
> +++ b/tests/status-detached.test
> @@ -0,0 +1,17 @@
> +#!/bin/sh
> +#
> +# Check -e status=detached option.
> +#
> +# Copyright (c) 2019 Paul Chaignon <paul.chaignon at gmail.com>
> +# All rights reserved.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +. "${srcdir=.}/init.sh"
> +
> +# -I2 avoids blocking all fatal signals, the default when using -o.
> +../../strace -o "$LOG" -I2 -e trace=nanosleep -e status=detached ../sleep 2 &

This has to be $STRACE instead of ../../strace,
see tests/init.sh for the case when $STRACE differs from ../../strace.

I don't think -e trace=nanosleep is needed in this test.

Since the only detached syscall here is nanosleep, it would be better
to remove -e trace=nanosleep so the test would be able to detect the
situation when status=detached misses that nanosleep syscall.


-- 
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/20190702/fb2f651a/attachment.bin>


More information about the Strace-devel mailing list