test: test_periodical_metadata_flush shrink timer period, kill app
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 21 Jul 2013 23:22:06 +0000 (19:22 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sun, 21 Jul 2013 23:22:06 +0000 (19:22 -0400)
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 <mathieu.desnoyers@efficios.com>
tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush

index fe4550bf3db4e4f41638689996655006fe3f556c..a5950b5e33f3169a2cb0cc05a5c75925a313ba20 100755 (executable)
@@ -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=$?
 
This page took 0.036304 seconds and 4 git commands to generate.