Fix: test flaky sleep and wait patterns
[lttng-tools.git] / tests / regression / ust / java-jul / test_java_jul
index a91904af4b28f1323a9f5a04aad4e2d97d2c4151..08214c0ebb8ad25e0521ff350cf7754a335ef79f 100755 (executable)
@@ -80,7 +80,8 @@ function test_jul_before_start ()
 
        start_lttng_tracing $SESSION_NAME
 
-       wait_apps
+       # Wait for the applications started in background
+       wait
 
        stop_lttng_tracing $SESSION_NAME
        destroy_lttng_session $SESSION_NAME
@@ -296,7 +297,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
@@ -311,7 +313,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
@@ -323,6 +329,31 @@ function test_jul_destroy_session()
        fi
 }
 
+function test_jul_disable()
+{
+       diag "Test JUL disable event"
+
+       create_lttng_session $SESSION_NAME $TRACE_PATH/$SESSION_NAME
+       # Enable all event with a filter.
+       enable_jul_lttng_event $SESSION_NAME $EVENT_NAME
+       enable_jul_lttng_event $SESSION_NAME $EVENT_NAME2
+       disable_jul_lttng_event $SESSION_NAME $EVENT_NAME
+       start_lttng_tracing $SESSION_NAME
+
+       # Fire second TP but not the finest one.
+       run_app 0 1
+       wait_apps
+
+       stop_lttng_tracing $SESSION_NAME
+       destroy_lttng_session $SESSION_NAME
+
+       # Validate test. Expecting one event of the second TP only.
+       trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME
+       if [ $? -ne 0 ]; then
+               return $?
+       fi
+}
+
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
@@ -338,6 +369,7 @@ skip $withapp "JUL support is needed. Skipping all tests." $NUM_TESTS ||
        start_lttng_sessiond
 
        tests=(
+               test_jul_disable
                test_jul_multi_session_loglevel
                test_jul_destroy_session
                test_jul_loglevel
@@ -355,7 +387,7 @@ skip $withapp "JUL support is needed. Skipping all tests." $NUM_TESTS ||
                if [ $? -ne 0 ]; then
                        break;
                fi
-               rm -rf $TRACE_PATH
+               #rm -rf $TRACE_PATH
        done
 
        stop_lttng_sessiond
This page took 0.025304 seconds and 4 git commands to generate.