Fix: add missing synchronization point for before app test case
[lttng-tools.git] / tests / regression / ust / buffers-pid / test_buffers_pid
index 0258e890cd4bb02b4c6b9400ff98ffaf74f30dc0..c95a4a1f9f7c4acb9a51210f00db3ee531f0a255 100755 (executable)
@@ -74,22 +74,26 @@ test_after_multiple_apps() {
 test_before_multiple_apps() {
        local out
        local i
 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
 
        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
 
                ok $? "Start application $i for tracing"
        done
 
-       #FIXME: racy missing synchronization
-
        # BEFORE application is spawned
        create_lttng_session $SESSION_NAME $TRACE_PATH
        enable_channel_per_pid $SESSION_NAME "channel0"
        enable_ust_lttng_event $SESSION_NAME $EVENT_NAME "channel0"
        start_lttng_tracing $SESSION_NAME
 
        # BEFORE application is spawned
        create_lttng_session $SESSION_NAME $TRACE_PATH
        enable_channel_per_pid $SESSION_NAME "channel0"
        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"
        diag "Waiting for applications to end"
        wait
        pass "Waiting done"
@@ -97,6 +101,11 @@ test_before_multiple_apps() {
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
 
        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"
        out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
        if [ $out -eq 0 ]; then
                fail "Trace validation"
@@ -136,6 +145,8 @@ test_after_app() {
 
 test_before_app() {
        local out
 
 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"
 
 
        diag "Start application BEFORE tracing is started"
 
@@ -145,18 +156,21 @@ test_before_app() {
        enable_channel_per_pid $SESSION_NAME "channel0"
        enable_ust_lttng_event $SESSION_NAME $EVENT_NAME "channel0"
 
        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"
 
        ok $? "Start application to trace"
 
-       #FIXME: racy missing synchronization
-
        start_lttng_tracing $SESSION_NAME
 
        start_lttng_tracing $SESSION_NAME
 
+       touch ${file_sync_before_last}
+
        wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
 
        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"
        out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
        if [ $out -eq 0 ]; then
                fail "Trace validation"
This page took 0.024338 seconds and 4 git commands to generate.