Tests: use babeltrace2 for all tests
[lttng-tools.git] / tests / regression / tools / clear / test_ust
index 04b713909c7a664e28ec46839424e35d05839ff2..27cd71fe9299b21f0778c407c4edc0f4f9a98b36 100755 (executable)
@@ -19,7 +19,7 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
 NUM_TESTS=2071
 
 PAGE_SIZE=$(getconf PAGE_SIZE)
-TRACE_PATH=$(mktemp -d)
+TRACE_PATH=$(mktemp --tmpdir -d tmp.test_clear_ust_trace_path.XXXXXX)
 
 source $TESTDIR/utils/utils.sh
 
@@ -31,7 +31,7 @@ function clean_path ()
 {
        local trace_path=$1
        set -u
-       rm -rf $trace_path/*
+       rm -rf $trace_path
        set +u
 }
 
@@ -244,8 +244,8 @@ function test_ust_basic_streaming_live_viewer ()
        local local_path="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
        local remote_trace_path="${HOSTNAME}/${SESSION_NAME}"
        local channel_name="chan"
-       local bt_output_path=$(mktemp -u)
-       local file_sync_before_exit=$(mktemp -u)
+       local bt_output_path=$(mktemp --tmpdir -u tmp.test_${FUNCNAME[0]}_bt_output_path.XXXXXX)
+       local file_sync_before_exit=$(mktemp --tmpdir -u tmp.test_${FUNCNAME[0]}_sync_before_exit.XXXXXX)
 
        diag "Test ust basic streaming live with viewer"
        diag "Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
@@ -296,7 +296,7 @@ function test_ust_streaming_live_viewer ()
        local local_path="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
        local remote_trace_path="${HOSTNAME}/${SESSION_NAME}"
        local channel_name="chan"
-       local bt_output_path=$(mktemp -d)/bt-output.txt
+       local bt_output_path=$(mktemp --tmpdir -u tmp.test_${FUNCNAME[0]}_bt_output_path.XXXXXX)
 
        diag "Test ust streaming live clear with viewer"
        diag "Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
@@ -335,13 +335,10 @@ function test_ust_streaming_live_viewer_new_metadata_after_clear ()
        local local_path="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
        local remote_trace_path="${HOSTNAME}/${SESSION_NAME}"
        local channel_name="chan"
-       local bt_output_path
-       local bt_error_path
-       local file_sync_before_exit
 
-       bt_output_path=$(mktemp -d)/bt-output.txt
-       bt_error_path=$(mktemp -d)/bt-output.err
-       file_sync_before_exit=$(mktemp -u)
+       local bt_output_path=$(mktemp --tmpdir -t "tmp.${FUNCNAME[0]}_bt_output.XXXXXX")
+       local bt_error_path=$(mktemp --tmpdir -t "tmp.${FUNCNAME[0]}_bt_error.XXXXXX")
+       local file_sync_before_exit=$(mktemp --tmpdir -u -t "tmp.${FUNCNAME[0]}_sync_before_exit.XXXXXX")
 
        diag "Test ust streaming live clear with viewer with new metadata after clear"
        diag "Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
@@ -411,6 +408,7 @@ function test_ust_streaming_live_viewer_new_metadata_after_clear ()
 
        clean_path "$bt_output_path"
        clean_path "$bt_error_path"
+       rm -f "$file_sync_before_exit"
 }
 
 function test_ust_local ()
@@ -619,10 +617,10 @@ function test_ust_local_snapshot_per_pid ()
        # 3, 4 unused.
        local buffer_type=$5
        local channel_name="channel0"
-       local file_sync_before_last=$(mktemp -u)
-       local file_sync_before_last_touch=$(mktemp -u)
-       local file_sync_before_exit=$(mktemp -u)
-       local file_sync_before_exit_touch=$(mktemp -u)
+       local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
+       local file_sync_before_last_touch=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last_touch.XXXXXX")
+       local file_sync_before_exit=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_exit.XXXXXX")
+       local file_sync_before_exit_touch=$(mktemp --tmpdir -u -t "tmp.${FUNCNAME[0]}_sync_before_exit_touch.XXXXXX")
 
        diag "Test ust local snapshot clear per pid"
        diag "Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
@@ -805,6 +803,8 @@ plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
 
+bail_out_if_no_babeltrace
+
 streaming_tests=(test_ust_streaming
        test_ust_streaming_rotate_clear
        test_ust_streaming_clear_rotate
@@ -939,3 +939,5 @@ stop_lttng_sessiond
 stop_lttng_relayd
 
 test_ust_disallow_clear
+
+rm -rf "$TRACE_PATH"
This page took 0.025498 seconds and 4 git commands to generate.