Fix: add missing synchronization point for before app test case
[lttng-tools.git] / tests / regression / ust / java-jul / test_java_jul
index 421c0f51f5e8f387f906d35dd8ad8683281c3bf1..5c784940be3698e386b3e856969932521513c718 100755 (executable)
@@ -38,7 +38,8 @@ function run_app
        local finest_tp=$1
        local fire_second_tp=$2
 
-       java -cp $JAVA_CP -Djava.library.path="/usr/local/lib:/usr/lib" $TESTAPP_NAME $NR_ITER $NR_MSEC_WAIT $finest_tp $fire_second_tp >/dev/null 2>&1 &
+       #FIXME: app should have synchro.
+       java -cp $JAVA_CP -Djava.library.path="/usr/local/lib:/usr/lib" $TESTAPP_NAME $NR_ITER $NR_MSEC_WAIT $finest_tp $fire_second_tp >/dev/null 2>&1
 }
 
 function wait_apps
@@ -81,6 +82,9 @@ function enable_jul_filter()
 
 function test_jul_before_start ()
 {
+       local file_sync_after_first=$(mktemp -u)
+       local file_sync_before_last=$(mktemp -u)
+
        diag "Test JUL application BEFORE tracing starts"
        create_lttng_session $SESSION_NAME $TRACE_PATH
        enable_jul_lttng_event $SESSION_NAME $EVENT_NAME
@@ -90,11 +94,17 @@ function test_jul_before_start ()
 
        start_lttng_tracing $SESSION_NAME
 
-       wait_apps
+       touch ${file_sync_before_last}
+
+       # Wait for the applications started in background
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
 
+       rm -f ${file_sync_after_first}
+       rm -f ${file_sync_before_last}
+
        # Validate test. Expecting all events.
        trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH
        if [ $? -ne 0 ]; then
@@ -342,7 +352,8 @@ function test_jul_destroy_session()
        # Run 5 times with a 1 second delay
        run_app 0 1
 
-       sleep 1
+       # Wait for the applications started in background
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -357,7 +368,11 @@ function test_jul_destroy_session()
        enable_jul_lttng_event $SESSION_NAME $EVENT_NAME2
        start_lttng_tracing $SESSION_NAME
 
-       wait_apps
+       # Run 5 times with a 1 second delay
+       run_app_background 0 1
+
+       # Wait for the applications started in background
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
This page took 0.023834 seconds and 4 git commands to generate.