Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: Nathan_Lynch@mentor.com (Nathan Lynch)
Subject: [lttng-dev] [PATCH lttng-tools] Fix: mi test: possible race between listing UST events and testapp start
Date: Mon, 27 Oct 2014 15:48:15 -0500	[thread overview]
Message-ID: <544EAF8F.7070904@mentor.com> (raw)
In-Reply-To: <1414372906-22433-1-git-send-email-jonathan.r.julien@gmail.com>

On 10/26/2014 08:21 PM, Jonathan Rajotte wrote:
> Signed-off-by: Jonathan Rajotte <jonathan.r.julien at gmail.com>

More description of the change is needed IMO.

> ---
>  tests/regression/tools/mi/test_mi | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/regression/tools/mi/test_mi b/tests/regression/tools/mi/test_mi
> index fa46b51..7acec18 100755
> --- a/tests/regression/tools/mi/test_mi
> +++ b/tests/regression/tools/mi/test_mi
> @@ -507,6 +507,11 @@ function test_list_ust_event ()
>  
>  	#Begin testing
>  	$TESTAPP_BIN $NR_USEC_WAIT & 2>/dev/null
> +	pid=$!
> +
> +	#Wait for TESTAPP to run
> +	while ! kill -0 $pid 2> /dev/null; do :; done
> +
>  	list_lttng_with_opts "-u -f"

Is this an attempt to give the test program enough time to register
tracepoints?

If so, I agree there is a race, but I don't think this is the right way
to address it.  I would not expect the while ! kill loop to repeat at
all; if you remove the stderr redirection do you see any output, ever?

The exit status from kill $! is not a reliable indication that the shell
has execve'd the program in the background, and even if it were, it
would not be a reliable indication of how far the program has progressed
(e.g. whether it has got far enough along to register tracepoints).

If a test program needs to run in the background, yet needs to reach a
certain state before the rest of the test should proceed, then it should
have a way to indicate to the test harness that it has reached the
desired state.  The shell's rudimentary facilities for managing
concurrency are not sufficient.




  reply	other threads:[~2014-10-27 20:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27  1:21 Jonathan Rajotte
2014-10-27 20:48 ` Nathan Lynch [this message]
2014-10-27 22:50   ` Jonathan Rajotte
2014-10-29 18:23 ` David Goulet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=544EAF8F.7070904@mentor.com \
    --to=nathan_lynch@mentor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox