Fix: periodical flush check trace before stop
authorDavid Goulet <dgoulet@efficios.com>
Fri, 28 Jun 2013 16:07:17 +0000 (12:07 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Fri, 28 Jun 2013 16:07:17 +0000 (12:07 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush

index 18d8a46c1b7ea213fe8299baabdffaf3c48b1b72..03d83e31486ef430bdfd844eff44caf595905f9b 100755 (executable)
@@ -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
This page took 0.036807 seconds and 4 git commands to generate.