tests: Reduce sleep in regression/tools/clear/test_ust
[lttng-tools.git] / tests / regression / tools / clear / test_ust
index fadf0e952ea5427165527805f3cc76edcb8c8ec4..a73c80af229e50cc78523322dc2b8c3ace9aaef4 100755 (executable)
@@ -21,7 +21,8 @@ NUM_TESTS=2071
 PAGE_SIZE=$(getconf PAGE_SIZE)
 TRACE_PATH=$(mktemp -d -t tmp.test_clear_ust_trace_path.XXXXXX)
 
-source $TESTDIR/utils/utils.sh
+# shellcheck source=../utils/utils.sh
+source "$TESTDIR/utils/utils.sh"
 
 if [ ! -x "$TESTAPP_BIN" ]; then
        BAIL_OUT "No UST events binary detected."
@@ -269,7 +270,7 @@ function test_ust_basic_streaming_live_viewer ()
        local evcount=0
        while [ $evcount -ne 10 ]; do
                evcount=$(cat $bt_output_path | wc -l)
-               sleep 0.5
+               sleep 0.1
        done
        pass "Live viewer read $evcount events, expect 10"
 
@@ -369,7 +370,7 @@ function test_ust_streaming_live_viewer_new_metadata_after_clear ()
        local evcount=0
        while [ $evcount -ne 10 ]; do
                evcount=$(wc -l < "$bt_output_path")
-               sleep 0.5
+               sleep 0.1
        done
        pass "Live viewer read $evcount events, expect 10"
 
@@ -388,7 +389,7 @@ function test_ust_streaming_live_viewer_new_metadata_after_clear ()
        local evcount=0
        while [ $evcount -ne 12 ]; do
                evcount=$(wc -l < "$bt_output_path")
-               sleep 0.5
+               sleep 0.1
        done
        pass "Live viewer read $evcount events, expect 12"
 
@@ -636,10 +637,11 @@ function test_ust_local_snapshot_per_pid ()
                --sync-before-last-event-touch ${file_sync_before_last_touch} \
                --sync-before-exit ${file_sync_before_exit} \
                --sync-before-exit-touch ${file_sync_before_exit_touch} >/dev/null 2>&1 &
+       local app_pid="${!}"
 
        # Continue only when there is only the last event remaining.
        while [ ! -f "${file_sync_before_last_touch}" ]; do
-               sleep 0.5
+               sleep 0.1
        done
 
        # Take a first snapshot and validate that the events are present.
@@ -669,7 +671,7 @@ function test_ust_local_snapshot_per_pid ()
        # Wait for the before exit sync point. This ensure that we went over the
        # last tracepoint.
        while [ ! -f "${file_sync_before_exit_touch}" ]; do
-               sleep 0.5
+               sleep 0.1
        done
 
        # Make sure the snapshot contains the last event.
@@ -679,7 +681,7 @@ function test_ust_local_snapshot_per_pid ()
 
        # Release the application.
        touch ${file_sync_before_exit}
-       wait
+       wait "${app_pid}"
        destroy_lttng_session_ok $SESSION_NAME
 
        rm -f ${file_sync_before_last}
@@ -752,7 +754,7 @@ function test_ust_streaming_tracefile_rotation_overwrite_files ()
                --tracefile-size=$PAGE_SIZE --tracefile-count=2 --buffers-$buffer_type
        enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $channel_name
        start_lttng_tracing_ok $SESSION_NAME
-       taskset -c 0 $TESTAPP_BIN -i 200000
+       taskset -c "$(get_any_available_cpu)" $TESTAPP_BIN -i 200000
        do_clear_session $SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
        stop_lttng_tracing_ok $SESSION_NAME
 
@@ -767,7 +769,7 @@ function test_ust_streaming_tracefile_rotation_overwrite_files ()
        fi
 
        start_lttng_tracing_ok $SESSION_NAME
-       taskset -c 0 $TESTAPP_BIN -i 400000
+       taskset -c "$(get_any_available_cpu)" $TESTAPP_BIN -i 400000
        stop_lttng_tracing_ok
 
        if [[ $rotate_before -eq 1 ]]; then
This page took 0.02487 seconds and 4 git commands to generate.