Fix: add missing synchronization point for before app test case
[lttng-tools.git] / tests / regression / ust / buffers-pid / test_buffers_pid
index 6624a55f28feb76ebc7e77a1f846b34036e73252..759a5662f74a9ee2c3af39effad29f93cb00660a 100755 (executable)
@@ -58,9 +58,10 @@ test_after_multiple_apps() {
        start_lttng_tracing $SESSION_NAME
 
        for i in `seq 1 5`; do
-               $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
+               $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1 &
                ok $? "Start application $i for tracing"
        done
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -73,11 +74,13 @@ test_after_multiple_apps() {
 test_before_multiple_apps() {
        local out
        local i
+       local file_sync_after_first=$(mktemp -u)
+       local file_sync_before_last=$(mktemp -u)
 
        diag "Start multiple applications BEFORE tracing is started"
 
        for i in `seq 1 5`; do
-               $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT & >/dev/null 2>&1
+               $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first}_${i} ${file_sync_before_last}_${i} >/dev/null 2>&1 &
                ok $? "Start application $i for tracing"
        done
 
@@ -87,6 +90,10 @@ test_before_multiple_apps() {
        enable_ust_lttng_event $SESSION_NAME $EVENT_NAME "channel0"
        start_lttng_tracing $SESSION_NAME
 
+       for i in `seq 1 5`; do
+               touch ${file_sync_before_last}_${i}
+       done
+
        diag "Waiting for applications to end"
        wait
        pass "Waiting done"
@@ -94,6 +101,11 @@ test_before_multiple_apps() {
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
 
+       for i in `seq 1 5`; do
+               rm -f ${file_sync_after_first}_${i}
+               rm -f ${file_sync_before_last}_${i}
+       done
+
        out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
        if [ $out -eq 0 ]; then
                fail "Trace validation"
@@ -119,8 +131,9 @@ test_after_app() {
        enable_ust_lttng_event $SESSION_NAME $EVENT_NAME "channel0"
        start_lttng_tracing $SESSION_NAME
 
-       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT &
        ok $? "Start application to trace"
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -132,6 +145,8 @@ test_after_app() {
 
 test_before_app() {
        local out
+       local file_sync_after_first=$(mktemp -u)
+       local file_sync_before_last=$(mktemp -u)
 
        diag "Start application BEFORE tracing is started"
 
@@ -141,16 +156,21 @@ test_before_app() {
        enable_channel_per_pid $SESSION_NAME "channel0"
        enable_ust_lttng_event $SESSION_NAME $EVENT_NAME "channel0"
 
-       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT &
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} &
        ok $? "Start application to trace"
 
        start_lttng_tracing $SESSION_NAME
 
-       wait ${!}
+       touch ${file_sync_before_last}
+
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
 
+       rm -f ${file_sync_after_first}
+       rm -f ${file_sync_before_last}
+
        out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
        if [ $out -eq 0 ]; then
                fail "Trace validation"
@@ -190,8 +210,9 @@ test_multiple_channels() {
        ok $? "Enable event $EVENT_NAME for session $SESSION_NAME in channel4"
        start_lttng_tracing $SESSION_NAME
 
-       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT &
        ok $? "Start application to trace"
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        trace_matches $EVENT_NAME $[NR_ITER * 5] $TRACE_PATH
This page took 0.024497 seconds and 4 git commands to generate.