From: Christian Babeux Date: Fri, 18 Apr 2014 17:10:09 +0000 (-0400) Subject: Fix: Racy event validation in tests X-Git-Tag: v2.4.2~29 X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;ds=sidebyside;h=291a814d1a19edae5d01266bcc135469d43a71bb;hp=291a814d1a19edae5d01266bcc135469d43a71bb;p=lttng-tools.git 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 Signed-off-by: David Goulet ---