From a055228df9bb90dd8225a540c7113d2ee1ca65a3 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sun, 21 Jul 2013 19:22:06 -0400 Subject: [PATCH 1/1] test: test_periodical_metadata_flush shrink timer period, kill app Decrease the switch timer period to 100ms (instead of 1s), since we're only getting 2s worth of app run. If the system is busy, nothing really guarantee that the timer will indeed fire during this time-frame (so strictly speaking, this test could still fail). Also, kill the application before trying to read the trace: this should ensure that the trace is not appended to concurrently with validation. Signed-off-by: Mathieu Desnoyers --- .../test_periodical_metadata_flush | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 deletions(-) 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 fe4550bf3..a5950b5e3 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,7 @@ 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 --switch-timer 1000000 >/dev/null 2>&1 + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name --switch-timer 100000 >/dev/null 2>&1 ok $? "Enable channel $channel_name per UID for session $sess_name" } @@ -50,7 +50,7 @@ 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 + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-pid -u $channel_name -s $sess_name --switch-timer 100000 >/dev/null 2>&1 ok $? "Enable channel $channel_name per UID for session $sess_name" } @@ -103,18 +103,25 @@ test_after_app_pid() { diag "Start application AFTER tracing is started" - # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH enable_metadata_per_pid $SESSION_NAME enable_channel_per_pid $SESSION_NAME "channel0" enable_ust_lttng_event $SESSION_NAME $EVENT_NAME "channel0" start_lttng_tracing $SESSION_NAME + # Start application after tracing $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ok $? "Start application to trace" # At least hit one event sleep 2 + + # Make sure the application does not generate any more data, + # thus ensuring that we are not flushing a packet concurrently + # with validate_trace. + killall -q $TESTAPP_NAME + sleep 2 + validate_trace out=$? @@ -132,7 +139,7 @@ test_before_app_pid() { $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & ok $? "Start application to trace" - # BEFORE application is spawned + # Start application before tracing create_lttng_session $SESSION_NAME $TRACE_PATH enable_metadata_per_pid $SESSION_NAME enable_channel_per_pid $SESSION_NAME "channel0" @@ -141,6 +148,13 @@ test_before_app_pid() { # At least hit one event sleep 2 + + # Make sure the application does not generate any more data, + # thus ensuring that we are not flushing a packet concurrently + # with validate_trace. + killall -q $TESTAPP_NAME + sleep 2 + validate_trace out=$? @@ -157,18 +171,25 @@ test_after_app_uid() { diag "Start application AFTER tracing is started" - # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH enable_metadata_per_uid $SESSION_NAME enable_channel_per_uid $SESSION_NAME "channel0" enable_ust_lttng_event $SESSION_NAME $EVENT_NAME "channel0" start_lttng_tracing $SESSION_NAME + # Start application after tracing $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ok $? "Start application to trace" # At least hit one event sleep 2 + + # Make sure the application does not generate any more data, + # thus ensuring that we are not flushing a packet concurrently + # with validate_trace. + killall -q $TESTAPP_NAME + sleep 2 + validate_trace out=$? @@ -183,10 +204,10 @@ test_before_app_uid() { diag "Start application BEFORE tracing is started" + # Start application after tracing $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & ok $? "Start application to trace" - # BEFORE application is spawned create_lttng_session $SESSION_NAME $TRACE_PATH enable_metadata_per_uid $SESSION_NAME enable_channel_per_uid $SESSION_NAME "channel0" @@ -195,6 +216,13 @@ test_before_app_uid() { # At least hit one event sleep 2 + + # Make sure the application does not generate any more data, + # thus ensuring that we are not flushing a packet concurrently + # with validate_trace. + killall -q $TESTAPP_NAME + sleep 2 + validate_trace out=$? -- 2.34.1