Fix: add missing synchronization point for before app test case
[lttng-tools.git] / tests / regression / ust / java-log4j / test_java_log4j
index b4846c323d625578815b1457ea4153b288e70e80..a0b7cdc0f9592bb6a5d567ed71e1183fead22f23 100755 (executable)
@@ -39,6 +39,7 @@ function run_app
        local debug_tp=$1
        local fire_second_tp=$2
 
+       # FIXME: test app should have synchro.
        java -cp $JAVA_CP -Djava.library.path="/usr/local/lib:/usr/lib" $TESTAPP_NAME $NR_ITER $NR_MSEC_WAIT $debug_tp $fire_second_tp >/dev/null 2>&1
 }
 
@@ -90,6 +91,9 @@ function enable_log4j_filter_loglevel_only()
 
 function test_log4j_before_start ()
 {
+       local file_sync_after_first=$(mktemp -u)
+       local file_sync_before_last=$(mktemp -u)
+
        diag "Test LOG4J application BEFORE tracing starts"
        create_lttng_session $SESSION_NAME $TRACE_PATH
        enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME
@@ -99,12 +103,17 @@ function test_log4j_before_start ()
 
        start_lttng_tracing $SESSION_NAME
 
+       touch ${file_sync_before_last}
+
        # Wait for the applications started in background
-       wait ${!}
+       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_match_only $EVENT_NAME $NR_ITER $TRACE_PATH
        if [ $? -ne 0 ]; then
@@ -399,8 +408,8 @@ function test_log4j_destroy_session()
 
        # Run 5 times with a 1 second delay
        run_app_background 0 1
-
-       sleep 1
+       # Wait for the applications started in background
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -415,8 +424,10 @@ function test_log4j_destroy_session()
        enable_log4j_lttng_event $SESSION_NAME $EVENT_NAME2
        start_lttng_tracing $SESSION_NAME
 
+       # Run 5 times with a 1 second delay
+       run_app_background 0 1
        # Wait for the applications started in background
-       wait ${!}
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
This page took 0.024794 seconds and 4 git commands to generate.