[PATCH v7 4/4] tests: check status qualifier
Dmitry V. Levin
ldv at altlinux.org
Thu Jul 11 12:38:49 UTC 2019
On Wed, Jul 10, 2019 at 02:11:32PM +0200, Paul Chaignon wrote:
> On Wed, Jul 10, 2019 at 03:16:33AM +0300, Dmitry V. Levin wrote:
> > On Sat, Jul 06, 2019 at 09:20:15AM +0200, Paul Chaignon wrote:
> > [...]
> > > diff --git a/tests/status-detached.test b/tests/status-detached.test
> > > new file mode 100755
> > > index 00000000..8db11163
> > > --- /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 status=detached ../sleep 2 &
> > > +pid=$!
> > > +../sleep 1
> > > +kill $pid
> > > +match_grep
> >
> > There has to be a "wait" between kill and match_grep to avoid the race
> > between strace writing its "<detached ...>" output and match_grep checking it.
>
> Ah, thanks a lot! I had this test fail once in Travis CI but was unable
> to reproduce locally and the error message showed nothing wrong (probably
> because the log file was written between the check and the error message
> display).
I actually suggest to add a "wait" statement to wait for strace completion
before checking its output, not a racy wait like "../sleep 0.1".
--
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/20190711/cb3bb283/attachment.bin>
More information about the Strace-devel
mailing list