summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2ce0e85)
Use the bash shell "wait" to wait for all background tasks rather than
the racy "pidof". Indeed, it's possible that applications have been
forked, but not executed yet, when pidof is done, which would therefore
miss applications. Using "wait" from the shell solves this.
If we want to be really strict, we should have sessiond, consumerd, and
relayd export a file containing their own PID, and wait for this instead
of using pidof. But this will be for another fix.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+function stop_trace_app()
+{
+ diag "Killing $TESTAPP_NAME"
+ PID_APP=`pidof $TESTAPP_NAME`
+ kill $PID_APP >/dev/null 2>&1
+ diag "Waiting on $TESTAPP_NAME"
+ wait
+}
+
# Test a snapshot using a default name for the output destination.
function test_ust_default_name_with_del()
{
# Test a snapshot using a default name for the output destination.
function test_ust_default_name_with_del()
{
echo $TRACE_PATH/$HOSTNAME/snapshot-1
validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
if [ $? -ne 0 ]; then
echo $TRACE_PATH/$HOSTNAME/snapshot-1
validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
if [ $? -ne 0 ]; then
# Validate test with the next ID since a del output was done prior.
validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-2*
if [ $? -ne 0 ]; then
# Validate test with the next ID since a del output was done prior.
validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-2*
if [ $? -ne 0 ]; then
return $?
fi
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
return $?
fi
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
- diag "Killing $TESTAPP_NAME"
- PID_APP=`pidof $TESTAPP_NAME`
- kill $PID_APP >/dev/null 2>&1
validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
out=$?
validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
out=$?
- diag "Killing $TESTAPP_NAME"
- PID_APP=`pidof $TESTAPP_NAME`
- kill $PID_APP >/dev/null 2>&1
validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
out=$?
validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/snapshot-1*
out=$?
- diag "Killing $TESTAPP_NAME"
- PID_APP=`pidof $TESTAPP_NAME`
- kill $PID_APP >/dev/null 2>&1
- diag "Killing $TESTAPP_NAME"
- PID_APP=`pidof $TESTAPP_NAME`
- kill $PID_APP >/dev/null 2>&1
-function kill_test_app()
+function stop_test_app()
{
diag "Killing $TESTAPP_NAME"
PID_APP=`pidof $TESTAPP_NAME`
kill $PID_APP >/dev/null 2>&1
{
diag "Killing $TESTAPP_NAME"
PID_APP=`pidof $TESTAPP_NAME`
kill $PID_APP >/dev/null 2>&1
+ diag "Waiting on $TESTAPP_NAME"
+ wait
}
function snapshot_add_output ()
}
function snapshot_add_output ()
}
function test_ust_local_snapshot_max_size ()
}
function test_ust_local_snapshot_max_size ()
}
function test_ust_local_snapshot_large_metadata ()
}
function test_ust_local_snapshot_large_metadata ()
}
function test_ust_per_uid_local_snapshot_post_mortem ()
}
function test_ust_per_uid_local_snapshot_post_mortem ()
# Returns once the application has at least fired ONE tracepoint.
start_test_app
# Returns once the application has at least fired ONE tracepoint.
start_test_app
lttng_snapshot_record $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
lttng_snapshot_record $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
source $TESTDIR/utils/utils.sh
source $TESTDIR/utils/utils.sh
-function wait_apps
-{
- while [ -n "$(pidof $TESTAPP_NAME)" ]; do
- sleep 1
- done
- pass "Wait for applications to end"
-}
-
function test_high_throughput
{
NETWORK_URI="net://localhost"
function test_high_throughput
{
NETWORK_URI="net://localhost"
enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
start_lttng_tracing $SESSION_NAME
run_apps
enable_ust_lttng_event $SESSION_NAME $EVENT_NAME
start_lttng_tracing $SESSION_NAME
run_apps
+ diag "Waiting for applications to end"
+ wait
+ pass "waiting done"
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
validate_event_count
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
validate_event_count
TESTAPP_NAME="gen-ust-events"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
EVENT_NAME="tp:tptest"
TESTAPP_NAME="gen-ust-events"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
EVENT_NAME="tp:tptest"
source $TESTDIR/utils/utils.sh
source $TESTDIR/utils/utils.sh
ok $? "Enable channel $channel_name per PID for session $sess_name"
}
ok $? "Enable channel $channel_name per PID for session $sess_name"
}
-function wait_apps
-{
- diag "Waiting for applications to end..."
- while [ -n "$(pidof $TESTAPP_NAME)" ]; do
- sleep 1
- done
-}
-
test_after_multiple_apps() {
local out
local i
test_after_multiple_apps() {
local out
local i
enable_ust_lttng_event $SESSION_NAME $EVENT_NAME "channel0"
start_lttng_tracing $SESSION_NAME
enable_ust_lttng_event $SESSION_NAME $EVENT_NAME "channel0"
start_lttng_tracing $SESSION_NAME
- # At least hit one event
- sleep 2
+ diag "Waiting for applications to end"
+ wait
+ pass "Waiting done"
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
./$CURDIR/$BIN_NAME & >/dev/null 2>&1
done
./$CURDIR/$BIN_NAME & >/dev/null 2>&1
done
-while [ -n "$(pidof $BIN_NAME)" ]; do
- sleep 0.5
-done
-pass "Wait for application end"
+diag "Waiting for applications to end"
+wait
+pass "Wait for applications to end"
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
-while [ -n "$(pidof $TESTAPP_NAME)" ]; do
- killall -q $TESTAPP_NAME >/dev/null 2>&1
- sleep 0.5
-done
-
-
-pass "Kill all spawned applications"
+diag "Stopping all spawned applications"
+killall -q $TESTAPP_NAME >/dev/null 2>&1
+wait
+pass "Stopped all spawned applications"
ok $? "Enable channel $channel_name per PID for session $sess_name"
}
ok $? "Enable channel $channel_name per PID for session $sess_name"
}
-function wait_apps
-{
- diag "Waiting for applications to end..."
- while [ -n "$(pidof $TESTAPP_NAME)" ]; do
- sleep 1
- done
-}
-
function validate_trace()
{
local out
function validate_trace()
{
local out
+ killall -SIGKILL -q $TESTAPP_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
- killall -SIGKILL -q $TESTAPP_NAME
- wait_apps
+ killall -SIGKILL -q $TESTAPP_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
- killall -SIGKILL -q $TESTAPP_NAME
- wait_apps
+ killall -SIGKILL -q $TESTAPP_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
- killall -SIGKILL -q $TESTAPP_NAME
- wait_apps
+ killall -SIGKILL -q $TESTAPP_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
stop_lttng_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
- killall -SIGKILL -q $TESTAPP_NAME
- wait_apps