From: David Goulet Date: Fri, 28 Jun 2013 16:07:17 +0000 (-0400) Subject: Fix: periodical flush check trace before stop X-Git-Tag: v2.2.1~15 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=9a936baab77f2f3c43651016e52165884b9ac88e;p=lttng-tools.git Fix: periodical flush check trace before stop Signed-off-by: David Goulet --- diff --git a/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush b/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush index 18d8a46c1..03d83e314 100755 --- a/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush +++ b/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush @@ -41,7 +41,16 @@ function enable_channel_per_uid() local sess_name=$1 local channel_name=$2 - $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name >/dev/null 2>&1 + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name --switch-timer 1000000 >/dev/null 2>&1 + ok $? "Enable channel $channel_name per UID for session $sess_name" +} + +function enable_channel_per_pid() +{ + local sess_name=$1 + local channel_name=$2 + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-pid -u $channel_name -s $sess_name --switch-timer 1000000 >/dev/null 2>&1 ok $? "Enable channel $channel_name per UID for session $sess_name" } @@ -71,6 +80,24 @@ function wait_apps done } +function validate_trace() +{ + local out + + out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) + if [ $out -eq 0 ]; then + fail "Trace validation" + diag "No event(s) found. We are supposed to have at least one." + out=1 + else + pass "Trace validation" + diag "Found $out event(s). Coherent." + out=0 + fi + + return $out +} + test_after_app_pid() { local out @@ -79,19 +106,22 @@ test_after_app_pid() { # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH enable_metadata_per_pid $SESSION_NAME - enable_ust_lttng_channel $SESSION_NAME "channel0" + enable_channel_per_pid $SESSION_NAME "channel0" enable_ust_lttng_event $SESSION_NAME $EVENT_NAME start_lttng_tracing $SESSION_NAME $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ok $? "Start application to trace" + # At least hit one event + sleep 2 + validate_trace + out=$? + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME - trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH - - return $? + return $out } test_before_app_pid() { @@ -105,27 +135,18 @@ test_before_app_pid() { # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH enable_metadata_per_pid $SESSION_NAME - enable_ust_lttng_channel $SESSION_NAME "channel0" + enable_channel_per_pid $SESSION_NAME "channel0" enable_ust_lttng_event $SESSION_NAME $EVENT_NAME start_lttng_tracing $SESSION_NAME # At least hit one event sleep 2 + validate_trace + out=$? stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME - out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) - if [ $out -eq 0 ]; then - fail "Trace validation" - diag "No event(s) found. We are supposed to have at least one." - out=1 - else - pass "Trace validation" - diag "Found $out event(s). Coherent." - out=0 - fi - wait_apps return $out @@ -146,12 +167,15 @@ test_after_app_uid() { $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ok $? "Start application to trace" + # At least hit one event + sleep 2 + validate_trace + out=$? + stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME - trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH - - return $? + return $out } test_before_app_uid() { @@ -171,21 +195,12 @@ test_before_app_uid() { # At least hit one event sleep 2 + validate_trace + out=$? stop_lttng_tracing $SESSION_NAME destroy_lttng_session $SESSION_NAME - out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l) - if [ $out -eq 0 ]; then - fail "Trace validation" - diag "No event(s) found. We are supposed to have at least one." - out=1 - else - pass "Trace validation" - diag "Found $out event(s). Coherent." - out=0 - fi - wait_apps return $out