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:53:35 +0000 (12:53 -0400)
commit291a814d1a19edae5d01266bcc135469d43a71bb
treef48307ba41672b3ed3949a6b425201667c279551
parent084ce6477c1b3f1720b3176e650232b10435e799
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.027733 seconds and 4 git commands to generate.