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)
commitd7ee608c00feacea3cfd5a740df64e5215347cb9
treeb5fac92df60b3a57a7dba0c55bf9c184501d3822
parente29a35e2caddb9bcb6b9e70ef5bd91ae252e7a88
Fix: Racy event validation in tests

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>
tests/regression/tools/exclusion/test_exclusion
tests/regression/tools/filtering/test_valid_filter
tests/regression/tools/tracefile-limits/test_tracefile_count
tests/regression/tools/tracefile-limits/test_tracefile_size
tests/regression/ust/buffers-pid/test_buffers_pid
This page took 0.025362 seconds and 4 git commands to generate.