Fix: Racy event validation in tests
authorChristian Babeux <christian.babeux@efficios.com>
Fri, 18 Apr 2014 17:10:09 +0000 (13:10 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 30 Apr 2014 16:44:53 +0000 (12:44 -0400)
This pattern is fundamentally racy:

$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 &

[...]

while [ -n "$(pidof $TESTAPP_BIN)" ]; do
   sleep 1
done
pass "Wait for application end"

[...]

tracing_teardown

validate_trace $EXACT_EVENT_COUNT

It is possible that the check for "pidof $TESTAPP_BIN" occurs _before_
the execve() of the applications (starting the applications in background
with & is basically a clone() + execve()). The consequence is that the check
succeed, never waiting for any applications to finish and then the tracing
sessions are prematurely teared down. Thus the resulting trace contains only
some events. We then validate for a fixed number of events and thus the test
fails caused by this racy scheduling situation.

The fix is to start the applications in foreground instead of background.

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>

No differences found
This page took 0.027854 seconds and 4 git commands to generate.