From 33e557114a2ba28e26e220a833e8a449c78b8b65 Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Fri, 14 May 2021 16:04:28 -0400 Subject: [PATCH] Cleanup: tests: name all temporary files to better identify leakage MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When using a template, we need to add `--tmpdir` to the `mktemp` arguments to place the tmp files in `/tmp` or `$TMPDIR`. Signed-off-by: Francis Deslauriers Signed-off-by: Jérémie Galarneau Change-Id: Id107530578d91700b726ceec016a8cef772e94b0 --- tests/destructive/metadata-regeneration | 10 +-- tests/perf/test_perf_raw.in | 8 ++- tests/regression/kernel/test_all_events | 2 +- tests/regression/kernel/test_callstack | 7 +- tests/regression/kernel/test_channel | 4 +- tests/regression/kernel/test_clock_override | 6 +- tests/regression/kernel/test_event_basic | 4 +- tests/regression/kernel/test_kernel_function | 2 +- tests/regression/kernel/test_lttng_logger | 6 +- tests/regression/kernel/test_ns_contexts | 2 +- .../regression/kernel/test_ns_contexts_change | 8 +-- .../kernel/test_rotation_destroy_flush | 2 +- .../regression/kernel/test_select_poll_epoll | 22 +++--- tests/regression/kernel/test_syscall | 49 +++++++------ tests/regression/kernel/test_userspace_probe | 70 +++++++++---------- tests/regression/tools/base-path/test_ust | 2 +- tests/regression/tools/channel/test_channel | 2 +- tests/regression/tools/clear/test_kernel | 8 +-- tests/regression/tools/clear/test_ust | 22 +++--- tests/regression/tools/crash/test_crash | 28 ++++---- .../regression/tools/exclusion/test_exclusion | 14 ++-- .../tools/filtering/test_invalid_filter | 2 +- .../tools/filtering/test_unsupported_op | 2 +- .../tools/filtering/test_valid_filter | 3 +- tests/regression/tools/health/test_health.sh | 8 +-- tests/regression/tools/health/test_thread_ok | 8 +-- tests/regression/tools/live/test_kernel | 2 +- tests/regression/tools/live/test_lttng_kernel | 2 +- tests/regression/tools/live/test_lttng_ust | 2 +- tests/regression/tools/live/test_ust | 4 +- .../tools/live/test_ust_tracefile_count | 4 +- tests/regression/tools/metadata/test_kernel | 9 +-- tests/regression/tools/metadata/test_ust | 16 ++--- tests/regression/tools/mi/test_mi | 8 +-- .../test_notification_kernel_buffer_usage | 12 ++-- .../test_notification_kernel_capture | 7 +- .../test_notification_kernel_error | 7 +- .../test_notification_kernel_instrumentation | 6 +- .../test_notification_kernel_syscall | 7 +- .../test_notification_kernel_userspace_probe | 7 +- .../notification/test_notification_multi_app | 14 ++-- ...test_notification_notifier_discarded_count | 16 ++--- .../test_notification_ust_buffer_usage | 14 ++-- .../test_notification_ust_capture | 6 +- .../notification/test_notification_ust_error | 5 +- ...ication_ust_event_rule_condition_exclusion | 6 +- .../tools/notification/test_rotation | 9 ++- .../tools/regen-metadata/test_kernel | 2 +- .../regression/tools/regen-metadata/test_ust | 18 ++--- .../tools/regen-statedump/test_kernel | 2 +- .../regression/tools/regen-statedump/test_ust | 6 +- .../regression/tools/relayd-grouping/test_ust | 8 +-- tests/regression/tools/rotation/test_kernel | 2 +- .../tools/rotation/test_save_load_mi | 6 +- .../tools/rotation/test_schedule_api | 2 +- tests/regression/tools/rotation/test_ust | 2 +- .../regression/tools/save-load/test_autoload | 4 +- tests/regression/tools/save-load/test_load | 14 ++-- tests/regression/tools/save-load/test_save | 2 +- tests/regression/tools/snapshots/test_kernel | 2 +- .../tools/snapshots/test_kernel_streaming | 2 +- .../tools/snapshots/test_ust_streaming | 4 +- tests/regression/tools/snapshots/ust_test | 4 +- .../streaming/test_high_throughput_limits | 7 +- tests/regression/tools/streaming/test_kernel | 2 +- tests/regression/tools/streaming/test_ust | 6 +- .../tracefile-limits/test_tracefile_count | 3 +- .../tracefile-limits/test_tracefile_size | 20 +++--- .../tools/tracker/test_event_tracker | 24 +++---- .../trigger/rate-policy/test_ust_rate_policy | 4 +- .../tools/trigger/start-stop/test_start_stop | 8 +-- .../tools/trigger/test_add_trigger_cli | 4 +- .../tools/trigger/test_list_triggers_cli | 6 +- .../tools/trigger/test_remove_trigger_cli | 6 +- .../tools/wildcard/test_event_wildcard | 4 +- .../test_relayd_working_directory | 34 +++------ .../ust/before-after/test_before_after | 8 +-- tests/regression/ust/blocking/test_blocking | 2 +- .../ust/buffers-pid/test_buffers_pid | 10 +-- .../ust/clock-override/test_clock_override | 6 +- .../ust/getcpu-override/test_getcpu_override | 2 +- .../ust/high-throughput/test_high_throughput | 6 +- tests/regression/ust/java-jul/test_java_jul | 6 +- .../regression/ust/java-log4j/test_java_log4j | 6 +- .../ust/low-throughput/test_low_throughput | 2 +- tests/regression/ust/multi-lib/test_multi_lib | 2 +- .../ust/multi-session/test_multi_session | 2 +- .../ust/namespaces/test_ns_contexts | 5 +- .../ust/namespaces/test_ns_contexts_change | 6 +- .../regression/ust/nprocesses/test_nprocesses | 6 +- tests/regression/ust/overlap/test_overlap | 2 +- .../test_periodical_metadata_flush | 4 +- .../ust/python-logging/test_python_logging.in | 8 +-- .../test_rotation_destroy_flush | 2 +- tests/regression/ust/test_event_basic | 2 +- tests/regression/ust/test_event_perf | 4 +- tests/regression/ust/test_event_tracef | 2 +- .../stress/test_multi_sessions_per_uid_10app | 2 +- ...test_multi_sessions_per_uid_5app_streaming | 2 +- ...essions_per_uid_5app_streaming_kill_relayd | 2 +- tests/utils/utils.sh | 6 +- 101 files changed, 367 insertions(+), 410 deletions(-) diff --git a/tests/destructive/metadata-regeneration b/tests/destructive/metadata-regeneration index fed3426c9..b81e7af32 100755 --- a/tests/destructive/metadata-regeneration +++ b/tests/destructive/metadata-regeneration @@ -18,7 +18,7 @@ TESTDIR=$CURDIR/.. NUM_TESTS=44 SESSION_NAME="regen" KERNEL_EVENT_NAME="lttng_test_filter_event" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d -t tmp.metadata_regen_after_data_change.XXXXXX) TESTAPP_PATH="$TESTDIR/utils/testapp" TESTAPP_NAME="gen-ust-events" @@ -109,8 +109,8 @@ function test_kernel_streaming () function test_ust_local () { - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") diag "Test UST local with metadata regeneration" date "+%Y-%m-%d %H:%M" -s "$DATE1 $HOUR" >/dev/null @@ -147,8 +147,8 @@ function test_ust_local () function test_ust_streaming () { - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") diag "Test UST streaming with metadata regeneration" date "+%Y-%m-%d %H:%M" -s "$DATE1 $HOUR" >/dev/null diff --git a/tests/perf/test_perf_raw.in b/tests/perf/test_perf_raw.in index 8138c25b4..f293ccd71 100644 --- a/tests/perf/test_perf_raw.in +++ b/tests/perf/test_perf_raw.in @@ -40,13 +40,13 @@ function have_libpfm() function test_ust_raw() { - local TRACE_PATH=$(mktemp -d) local SESSION_NAME="ust_perf" local CHAN_NAME="mychan" local EVENT_NAME="tp:tptest" local PMU="UNHALTED_REFERENCE_CYCLES" local tests_to_skip=9 local ret + local TRACE_PATH # Find the raw perf id of the event. PERFID=$("$CURDIR/find_event" "$PMU") @@ -64,6 +64,8 @@ function test_ust_raw() return fi + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + create_lttng_session_ok $SESSION_NAME $TRACE_PATH enable_ust_lttng_channel_ok $SESSION_NAME $CHAN_NAME @@ -87,7 +89,6 @@ function test_ust_raw() function test_kernel_raw() { - local TRACE_PATH=$(mktemp -d) local SESSION_NAME="kernel_perf" local CHAN_NAME="mychan" local EVENT_NAME="lttng_test_filter_event" @@ -95,6 +96,7 @@ function test_kernel_raw() local PERFID="" local tests_to_skip=9 local ret + local TRACE_PATH # Find the raw perf id of the event. PERFID=$("$CURDIR/find_event" "$PMU") @@ -112,6 +114,8 @@ function test_kernel_raw() return fi + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + create_lttng_session_ok $SESSION_NAME $TRACE_PATH lttng_enable_kernel_channel_ok $SESSION_NAME $CHAN_NAME diff --git a/tests/regression/kernel/test_all_events b/tests/regression/kernel/test_all_events index c700de823..75b045c9d 100755 --- a/tests/regression/kernel/test_all_events +++ b/tests/regression/kernel/test_all_events @@ -17,7 +17,7 @@ source $TESTDIR/utils/utils.sh function test_all_event() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_all_events_basic" create_lttng_session_ok $SESSION_NAME $TRACE_PATH diff --git a/tests/regression/kernel/test_callstack b/tests/regression/kernel/test_callstack index 42c3fcce4..b5759d442 100755 --- a/tests/regression/kernel/test_callstack +++ b/tests/regression/kernel/test_callstack @@ -36,8 +36,7 @@ function run_workload() # shift the first argument, passing along the other args if any to the # test app. shift - local start_file_sync - start_file_sync=$(mktemp -u) + local start_file_sync=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_first.XXXXXX") lttng_untrack_all @@ -61,7 +60,7 @@ function run_workload() function test_user_callstack() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") # This is the expected userspace callstack. (see gen-syscall-events-callstack.c) USER_CS_EXPECTED="main fct_a fct_b fct_c my_gettid" EVENT_NAME="gettid" @@ -85,7 +84,7 @@ function test_user_callstack() function test_kernel_callstack() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") # Those are symbol expected to be present in the kernel callstack. This # is not an exhaustive list since it's kernel dependent. diff --git a/tests/regression/kernel/test_channel b/tests/regression/kernel/test_channel index 158375d3c..9cc74c4e8 100755 --- a/tests/regression/kernel/test_channel +++ b/tests/regression/kernel/test_channel @@ -15,7 +15,7 @@ source $TESTDIR/utils/utils.sh function test_channel_buffer() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_session_name" CHANNEL_NAME="test_channel_name" create_lttng_session_ok "$SESSION_NAME" "$TRACE_PATH" @@ -30,7 +30,7 @@ function test_channel_buffer() function test_channel_buffer_too_large() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_session_name" CHANNEL_NAME="test_channel_name" create_lttng_session_ok "$SESSION_NAME" "$TRACE_PATH" diff --git a/tests/regression/kernel/test_clock_override b/tests/regression/kernel/test_clock_override index 4b185db89..cef30dc30 100755 --- a/tests/regression/kernel/test_clock_override +++ b/tests/regression/kernel/test_clock_override @@ -64,8 +64,8 @@ function extract_clock_metadata_token() function test_clock_override_metadata() { - local ctf_metadata_file=$(mktemp -p $TRACE_PATH ctf-metadata.XXXXXX) - local clock_metadata_file=$(mktemp -p $TRACE_PATH clock-metadata.XXXXXX) + local ctf_metadata_file=$(mktemp --tmpdir -p $TRACE_PATH ctf-metadata.XXXXXX) + local clock_metadata_file=$(mktemp --tmpdir -p $TRACE_PATH clock-metadata.XXXXXX) local result="" diag "Clock override plugin metadata test" @@ -184,7 +184,7 @@ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || while [ "$i" -lt "$TEST_COUNT" ]; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_clock_override_trace_path.XXXXXX) # Execute test ${TESTS[$i]} diff --git a/tests/regression/kernel/test_event_basic b/tests/regression/kernel/test_event_basic index f3a393eb8..c2500c69d 100755 --- a/tests/regression/kernel/test_event_basic +++ b/tests/regression/kernel/test_event_basic @@ -17,7 +17,7 @@ source $TESTDIR/utils/utils.sh function test_event_basic() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_event_basic" create_lttng_session_ok $SESSION_NAME $TRACE_PATH @@ -45,7 +45,7 @@ function test_event_basic() function test_enable_after_start() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_enable_after_start" create_lttng_session_ok $SESSION_NAME $TRACE_PATH diff --git a/tests/regression/kernel/test_kernel_function b/tests/regression/kernel/test_kernel_function index 3a7471c86..97f3faebf 100755 --- a/tests/regression/kernel/test_kernel_function +++ b/tests/regression/kernel/test_kernel_function @@ -15,7 +15,7 @@ source $TESTDIR/utils/utils.sh function test_kernel_function_basic() { - local TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") local SESSION_NAME="kernel_function_basic" local EVENT_NAME="my_event_name" local TARGET_SYMBOL="lttng_test_filter_event_write" diff --git a/tests/regression/kernel/test_lttng_logger b/tests/regression/kernel/test_lttng_logger index c0e2f71b4..9fa8ca33f 100755 --- a/tests/regression/kernel/test_lttng_logger +++ b/tests/regression/kernel/test_lttng_logger @@ -19,7 +19,7 @@ function test_proc_logger() { diag "Test /proc/lttng-logger" - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") create_lttng_session_ok $SESSION_NAME $TRACE_PATH @@ -50,7 +50,7 @@ function test_dev_logger() { diag "Test /dev/lttng-logger" - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") create_lttng_session_ok $SESSION_NAME $TRACE_PATH @@ -81,7 +81,7 @@ function test_payload_limit() { diag "Test lttng-logger payload limit" - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") create_lttng_session_ok $SESSION_NAME $TRACE_PATH diff --git a/tests/regression/kernel/test_ns_contexts b/tests/regression/kernel/test_ns_contexts index 1a25d8666..0c8718d78 100755 --- a/tests/regression/kernel/test_ns_contexts +++ b/tests/regression/kernel/test_ns_contexts @@ -76,7 +76,7 @@ function test_ns() ns_inode=$(stat -c '%i' -L "/proc/$$/ns/$ns") ok $? "Get current $ns namespace inode: $ns_inode" - trace_path=$(mktemp -d) + trace_path=$(mktemp --tmpdir -d tmp.{FUNCNAME[0]}_trace_path.XXXXXX) start_lttng_sessiond diff --git a/tests/regression/kernel/test_ns_contexts_change b/tests/regression/kernel/test_ns_contexts_change index 118d120a6..e32a75b8a 100755 --- a/tests/regression/kernel/test_ns_contexts_change +++ b/tests/regression/kernel/test_ns_contexts_change @@ -80,10 +80,10 @@ function test_ns() return fi - trace_path=$(mktemp -d) - file_sync_wait_before_unshare=$(mktemp -u) - file_sync_wait_after_unshare=$(mktemp -u) - file_sync_signal_after_unshare=$(mktemp -u) + trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + file_sync_wait_before_unshare=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_unshare.XXXXXX") + file_sync_wait_after_unshare=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_unshare.XXXXXX") + file_sync_signal_after_unshare=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_signal_after_unshare.XXXXXX") # Get the current ns inode number ns_inode=$(stat -c '%i' -L "/proc/$$/ns/$ns") diff --git a/tests/regression/kernel/test_rotation_destroy_flush b/tests/regression/kernel/test_rotation_destroy_flush index 722468f57..57434b0a5 100755 --- a/tests/regression/kernel/test_rotation_destroy_flush +++ b/tests/regression/kernel/test_rotation_destroy_flush @@ -132,7 +132,7 @@ skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || while [ "$i" -lt "$TEST_COUNT" ]; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_kernel_rotation_destroy_flush.XXXXXX) # Execute test ${TESTS[$i]} diff --git a/tests/regression/kernel/test_select_poll_epoll b/tests/regression/kernel/test_select_poll_epoll index 2aa4d6fe1..16b0da525 100755 --- a/tests/regression/kernel/test_select_poll_epoll +++ b/tests/regression/kernel/test_select_poll_epoll @@ -52,7 +52,7 @@ function check_trace_content() function test_working_cases() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" # arm64 does not have epoll_wait @@ -85,7 +85,7 @@ function test_working_cases() function test_timeout_cases() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" # arm64 does not have epoll_wait @@ -118,7 +118,7 @@ function test_timeout_cases() function test_pselect_invalid_fd() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" SYSCALL_LIST="pselect6" @@ -144,7 +144,7 @@ function test_pselect_invalid_fd() function test_big_ppoll() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" SYSCALL_LIST="ppoll" @@ -170,7 +170,7 @@ function test_big_ppoll() function test_ppoll_overflow() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" SYSCALL_LIST="ppoll" @@ -199,7 +199,7 @@ function test_ppoll_overflow() function test_pselect_invalid_ptr() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" SYSCALL_LIST="pselect6" @@ -225,7 +225,7 @@ function test_pselect_invalid_ptr() function test_ppoll_ulong_max() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" SYSCALL_LIST="ppoll" @@ -251,7 +251,7 @@ function test_ppoll_ulong_max() function test_epoll_pwait_invalid_ptr() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" SYSCALL_LIST="epoll_pwait" @@ -277,7 +277,7 @@ function test_epoll_pwait_invalid_ptr() function test_epoll_pwait_int_max() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" SYSCALL_LIST="epoll_pwait" @@ -303,7 +303,7 @@ function test_epoll_pwait_int_max() function test_ppoll_concurrent() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" SYSCALL_LIST="ppoll" @@ -329,7 +329,7 @@ function test_ppoll_concurrent() function test_epoll_pwait_concurrent() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="syscall_payload" SYSCALL_LIST="epoll_ctl,epoll_pwait" diff --git a/tests/regression/kernel/test_syscall b/tests/regression/kernel/test_syscall index 69a2bab8f..b193dfb88 100755 --- a/tests/regression/kernel/test_syscall +++ b/tests/regression/kernel/test_syscall @@ -20,8 +20,7 @@ source $TESTDIR/utils/utils.sh function trace_testapp() { - local start_file_sync - start_file_sync=$(mktemp -u) + local start_file_sync=$(mktemp --tmpdir -u -t "tmp.${FUNCNAME[0]}_sync_start.XXXXXX") # Clear all entries from the resource tracker lttng_untrack_kernel_all_ok @@ -73,7 +72,7 @@ function test_syscall_event_list() function test_syscall_simple_list() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_simple_list" local EVENT_NAME="close" @@ -101,7 +100,7 @@ function test_syscall_simple_list() function test_syscall_simple_list_two() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_simple_list_two" local EVENT_NAME="close" local EVENT_NAME2="read" @@ -135,7 +134,7 @@ function test_syscall_simple_list_two() function test_syscall_single() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_single" diag "Syscall trace single" @@ -160,7 +159,7 @@ function test_syscall_single() function test_syscall_two() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_two" diag "Syscall trace two events" @@ -188,7 +187,7 @@ function test_syscall_two() function test_syscall_all() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_all" diag "Syscall trace all events" @@ -214,7 +213,7 @@ function test_syscall_all() function test_syscall_all_disable_one() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_all_disable_one" diag "Syscall trace all events and disable one" @@ -243,7 +242,7 @@ function test_syscall_all_disable_one() function test_syscall_all_disable_two() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_all_disable_two" diag "Syscall trace all events and disable two" @@ -277,7 +276,7 @@ function test_syscall_all_disable_two() function test_syscall_enable_all_disable_all() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_all_disable_all" diag "Syscall trace all events and disable all" @@ -301,7 +300,7 @@ function test_syscall_enable_all_disable_all() function test_syscall_enable_all_disable_all_enable_all() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_all_disable_all_enable_all" diag "Syscall trace all events and enable/disable all" @@ -331,7 +330,7 @@ function test_syscall_enable_all_disable_all_enable_all() function test_syscall_enable_all_enable_one_disable_all() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_all_enable_one_disable_all" diag "Syscall trace all events, enable one and disable all" @@ -360,7 +359,7 @@ function test_syscall_enable_all_enable_one_disable_all() function test_syscall_enable_one_enable_all_disable_one() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_one_enable_all_disable_one" diag "Syscall trace all events and enable/disable one" @@ -389,7 +388,7 @@ function test_syscall_enable_one_enable_all_disable_one() function test_syscall_enable_one_enable_all_disable_all_disable_one() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_one_enable_all_disable_all_disable_one" diag "Syscall trace all events and enable/disable one" @@ -421,7 +420,7 @@ function test_syscall_enable_one_enable_all_disable_all_disable_one() function test_syscall_enable_all_disable_all_twice() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_all_disable_all_twice" diag "Syscall trace all events and enable/disable all twice" @@ -449,7 +448,7 @@ function test_syscall_enable_all_disable_all_twice() function test_syscall_enable_one_disable_one() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_one_disable_one" diag "Syscall trace one event and disable one" @@ -473,7 +472,7 @@ function test_syscall_enable_one_disable_one() function test_syscall_enable_two_disable_two() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_two_disable_two" diag "Syscall trace two events and disable two" @@ -499,7 +498,7 @@ function test_syscall_enable_two_disable_two() function test_syscall_enable_two_disable_one() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_two_disable_one" diag "Syscall trace two events and disable one" @@ -528,7 +527,7 @@ function test_syscall_enable_two_disable_one() function test_syscall_disable_twice() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_disable_twice" diag "Syscall trace one event and disable twice" @@ -548,7 +547,7 @@ function test_syscall_disable_twice() function test_syscall_disable_all_twice() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_disable_all_twice" diag "Syscall trace all events and disable all twice" @@ -569,7 +568,7 @@ function test_syscall_disable_all_twice() function test_syscall_enable_unknown() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_unknown" diag "Syscall enable an unknown event" @@ -587,7 +586,7 @@ function test_syscall_enable_unknown() function test_syscall_enable_all_enable_one() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_all_enable_one" diag "Syscall enable all and enable one" @@ -605,7 +604,7 @@ function test_syscall_enable_all_enable_one() function test_syscall_disable_all_disable_one() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_all_enable_one" diag "Syscall disable all and disable one" @@ -624,7 +623,7 @@ function test_syscall_disable_all_disable_one() function test_syscall_enable_channel_disable_all() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_channel_disable_all" CHANNEL_NAME="channel" @@ -644,7 +643,7 @@ function test_syscall_enable_channel_disable_all() function test_syscall_enable_channel_disable_one() { - TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="kernel_syscall_enable_channel_disable_all" CHANNEL_NAME="channel" diff --git a/tests/regression/kernel/test_userspace_probe b/tests/regression/kernel/test_userspace_probe index a71320274..0efcb9165 100755 --- a/tests/regression/kernel/test_userspace_probe +++ b/tests/regression/kernel/test_userspace_probe @@ -44,7 +44,7 @@ function validate_list() function test_userspace_probe_enable_file_noexist () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_file_noexist" ENABLE_EXPR="elf:/etc/file-not-exist:$ELF_SYMBOL" @@ -61,7 +61,7 @@ function test_userspace_probe_enable_file_noexist () function test_userspace_probe_enable_file_not_elf () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_file_not_elf" ENABLE_EXPR="elf:/etc/passwd:$ELF_SYMBOL" @@ -78,7 +78,7 @@ function test_userspace_probe_enable_file_not_elf () function test_userspace_probe_enable_elf_missing_symbol_name () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_elf_missing_symbol" ENABLE_EXPR="elf:$ELF_TEST_BIN:" @@ -95,7 +95,7 @@ function test_userspace_probe_enable_elf_missing_symbol_name () function test_userspace_probe_enable_elf_nonexistant_symbol () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_elf_nonexistant_symbol" ELF_SYMBOL_NO_EXIST="function_doesnt_exist" ENABLE_EXPR="elf:$ELF_TEST_BIN:$ELF_SYMBOL_NO_EXIST" @@ -113,7 +113,7 @@ function test_userspace_probe_enable_elf_nonexistant_symbol () function test_userspace_probe_enable_elf_symbol_not_function () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_elf_symbol_not_function" ELF_SYMBOL_NO_FUNC="not_a_function" ENABLE_EXPR="elf:$ELF_TEST_BIN:$ELF_SYMBOL_NO_FUNC" @@ -131,7 +131,7 @@ function test_userspace_probe_enable_elf_symbol_not_function () function test_userspace_probe_unsupported_types () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_unsupported_types" # Userspace probe at an address or at an offset to a function # instrumentation description types are not supported at the moment. @@ -156,7 +156,7 @@ function test_userspace_probe_unsupported_types () function test_userspace_probe_enable_implicit_probe_type () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_implicit_probe_type" ENABLE_EXPR="$ELF_TEST_BIN:$ELF_SYMBOL" @@ -178,7 +178,7 @@ function test_userspace_probe_enable_implicit_probe_type () function test_userspace_probe_enable_elf_symbol_exists () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_elf_symbol_exists" ENABLE_EXPR="elf:$ELF_TEST_BIN:$ELF_SYMBOL" @@ -200,7 +200,7 @@ function test_userspace_probe_enable_elf_symbol_exists () function test_userspace_probe_enable_in_path () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_in_path" ENABLE_EXPR="elf:$ELF_TEST_BIN_NAME:$ELF_SYMBOL" @@ -229,7 +229,7 @@ function test_userspace_probe_enable_in_path () function test_userspace_probe_enable_full_path () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_full_path" ENABLE_EXPR="elf:$(realpath $ELF_TEST_BIN):$ELF_SYMBOL" diag "Userspace probe with full path enabled successfully" @@ -250,9 +250,9 @@ function test_userspace_probe_enable_full_path () function test_userspace_probe_enable_colon_in_path () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userspace_probe_enable_colon_in_path" - COLON_FILE_PATH=$(mktemp -d) + COLON_FILE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") ELF_BIN_SYMLINK="$COLON_FILE_PATH/colon_:_in_name" ELF_BIN_WITH_COLON_IN_NAME_ESCAPED="$COLON_FILE_PATH/colon_\:_in_name" ENABLE_EXPR="elf:"$ELF_BIN_WITH_COLON_IN_NAME_ESCAPED":$ELF_SYMBOL" @@ -278,7 +278,7 @@ function test_userspace_probe_enable_colon_in_path () function test_userspace_probe_elf () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_elf" ENABLE_EXPR="elf:$ELF_TEST_BIN:$ELF_SYMBOL" @@ -301,7 +301,7 @@ function test_userspace_probe_elf () function test_userspace_probe_elf_dynamic_symbol () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_elf" LIBFOO_PATH="$ELF_TEST_BIN_DIR/libfoo.so" ENABLE_EXPR="elf:$LIBFOO_PATH:dynamic_symbol" @@ -325,7 +325,7 @@ function test_userspace_probe_elf_dynamic_symbol () function test_userspace_probe_elf_cxx_function () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_elf_cxx_function" # Probing C++ mangled symbols should work the same way as regular Elf # symbols @@ -351,7 +351,7 @@ function test_userspace_probe_elf_cxx_function () function test_userspace_probe_elf_cxx_method () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_elf_cxx_method" # Probing C++ mangled symbols should work the same way as regular Elf # symbols @@ -377,7 +377,7 @@ function test_userspace_probe_elf_cxx_method () function test_userspace_probe_elf_disable () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_elf_disable" ENABLE_EXPR="elf:$ELF_TEST_BIN:$ELF_SYMBOL" @@ -403,7 +403,7 @@ function test_userspace_probe_elf_disable () function test_userspace_probe_elf_list () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_elf_list" ENABLE_EXPR="elf:$ELF_TEST_BIN:$ELF_SYMBOL" @@ -431,9 +431,9 @@ function test_userspace_probe_save_load_elf() # saves the path to the link and not to the actual file. This is to # support instrumentation of shared objects that are often accessed # through symlinks and updated. - TRACE_PATH=$(mktemp -d) - TMP_LINK_DIR=$(mktemp -d) - TMP_SAVE_DIR=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + TMP_LINK_DIR=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + TMP_SAVE_DIR=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_save_load_elf" @@ -487,9 +487,9 @@ function test_userspace_probe_save_load_sdt() # saves the path to the link and not to the actual file. This is to # support instrumentation of shared objects that are often accessed # through symlinks and updated. - TRACE_PATH=$(mktemp -d) - TMP_LINK_DIR=$(mktemp -d) - TMP_SAVE_DIR=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + TMP_LINK_DIR=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + TMP_SAVE_DIR=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_save_load_sdt" PROVIDER="foobar" @@ -541,7 +541,7 @@ function test_userspace_probe_save_load_sdt() function test_userspace_probe_sdt () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") PROVIDER="foobar" PROBE="tp1" ENABLE_EXPR="sdt:$SDT_TEST_BIN:$PROVIDER:$PROBE" @@ -565,7 +565,7 @@ function test_userspace_probe_sdt () function test_userspace_probe_sdt_list () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_list" PROVIDER="foobar" PROBE="tp1" @@ -591,7 +591,7 @@ function test_userspace_probe_sdt_list () function test_userspace_probe_enable_sdt_nonexistant_provider () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_nonexistand_provider" PROVIDER="not_provider" PROBE="tp1" @@ -610,7 +610,7 @@ function test_userspace_probe_enable_sdt_nonexistant_provider () function test_userspace_probe_enable_sdt_nonexistant_probe () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_nonexistant_probe" PROVIDER="foobar" PROBE="not_a_tracepoint" @@ -629,7 +629,7 @@ function test_userspace_probe_enable_sdt_nonexistant_probe () function test_userspace_probe_enable_sdt_with_sema () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_with_sema" PROVIDER="foobar" PROBE="tp_with_semaphore" @@ -648,7 +648,7 @@ function test_userspace_probe_enable_sdt_with_sema () function test_userspace_probe_sdt_one_probe () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_one_probe" PROVIDER="foobar" PROBE="tp1" @@ -673,7 +673,7 @@ function test_userspace_probe_sdt_one_probe () function test_userspace_probe_sdt_two_probes () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_two_probes" PROVIDER="foobar" PROBE="tp2" @@ -698,7 +698,7 @@ function test_userspace_probe_sdt_two_probes () function test_userspace_probe_sdt_in_shared_object () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_shared_object" PROVIDER="foobar" PROBE="tp_in_shared_object" @@ -723,7 +723,7 @@ function test_userspace_probe_sdt_in_shared_object () function test_userspace_probe_sdt_in_shared_object_dlopen () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_shared_object_dlopen" PROVIDER="foobar" PROBE="tp_in_dlopen" @@ -748,7 +748,7 @@ function test_userspace_probe_sdt_in_shared_object_dlopen () function test_userspace_probe_sdt_in_shared_object_ldpreload () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_shared_object_ldpreload" PROVIDER="foobar" PROBE="tp_in_ldpreload" @@ -773,7 +773,7 @@ function test_userspace_probe_sdt_in_shared_object_ldpreload () function test_userspace_probe_sdt_with_arg () { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="test_userprobe_sdt_arg" PROVIDER="foobar" PROBE="tp_with_arg" diff --git a/tests/regression/tools/base-path/test_ust b/tests/regression/tools/base-path/test_ust index 51c954a88..fd1a67af8 100755 --- a/tests/regression/tools/base-path/test_ust +++ b/tests/regression/tools/base-path/test_ust @@ -13,7 +13,7 @@ TESTAPP_NAME="gen-ust-events" TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" EVENT_NAME="tp:tptest" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_base_path_ust_trace_path.XXXXXX) NUM_TESTS=42 diff --git a/tests/regression/tools/channel/test_channel b/tests/regression/tools/channel/test_channel index d4ffd56be..eaae3d9c1 100755 --- a/tests/regression/tools/channel/test_channel +++ b/tests/regression/tools/channel/test_channel @@ -19,7 +19,7 @@ source $TESTDIR/utils/utils.sh function test_channel_disable_stopped_session() { - local TRACE_PATH=$(mktemp -d) + local TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") local SESSION_NAME="test_channel" local CHAN_NAME="channel0" local EVENT_NAME="tp:tptest" diff --git a/tests/regression/tools/clear/test_kernel b/tests/regression/tools/clear/test_kernel index 01065748b..c12a153c5 100755 --- a/tests/regression/tools/clear/test_kernel +++ b/tests/regression/tools/clear/test_kernel @@ -11,7 +11,7 @@ TESTDIR=$CURDIR/../../.. EVENT_NAME="lttng_test_filter_event" PAGE_SIZE=$(getconf PAGE_SIZE) -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_clear_kernel_trace_path.XXXXXX) NUM_TESTS=837 @@ -200,8 +200,8 @@ function test_kernel_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 -t "tmp.${FUNCNAME[0]}_bt_output.XXXXXX") + local file_sync_before_exit=$(mktemp --tmpdir -u -t "tmp.${FUNCNAME[0]}_sync_before_exit.XXXXXX") diag "Test kernel basic streaming live with viewer" diag "Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice" @@ -247,7 +247,7 @@ function test_kernel_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 -t "tmp.${FUNCNAME[0]}_bt_output.XXXXXX") diag "Test kernel streaming live clear with viewer" diag "Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice" diff --git a/tests/regression/tools/clear/test_ust b/tests/regression/tools/clear/test_ust index 32bffbe0a..81ccb0006 100755 --- a/tests/regression/tools/clear/test_ust +++ b/tests/regression/tools/clear/test_ust @@ -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 @@ -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 -t tmp.test_ust_streaming_live_viewer_bt_output.XXXXXX) + 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" @@ -336,9 +336,9 @@ function test_ust_streaming_live_viewer_new_metadata_after_clear () local remote_trace_path="${HOSTNAME}/${SESSION_NAME}" local channel_name="chan" - local bt_output_path=$(mktemp -t tmp.test_ust_streaming_live_viewer_new_metadata_after_clear_bt_output.XXXXXX) - local bt_error_path=$(mktemp -t tmp.test_ust_streaming_live_viewer_new_metadata_after_clear_bt_error.XXXXXX) - local file_sync_before_exit=$(mktemp -u -t tmp.test_ust_streaming_live_viewer_new_metadata_after_clear_sync_before_exit.XXXXXX) + 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" @@ -617,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" diff --git a/tests/regression/tools/crash/test_crash b/tests/regression/tools/crash/test_crash index b941ff3b2..73e1e4f69 100755 --- a/tests/regression/tools/crash/test_crash +++ b/tests/regression/tools/crash/test_crash @@ -19,7 +19,7 @@ NR_USEC_WAIT=0 NR_ITER=-1 # Temp file output -OUTPUT_DIR=$(mktemp -d) +OUTPUT_DIR=$(mktemp -d --tmpdir tmp.test_crash_shm.XXXXXX) LAST_APP_PID= @@ -37,7 +37,7 @@ print_test_banner "$TEST_DESC" function start_test_app() { - local tmp_file=$(mktemp -u) + local tmp_file=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}.XXXXXX") # Start application with a temporary file. $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $tmp_file & @@ -93,7 +93,7 @@ function test_shm_path_per_pid() diag "Shm: ust per-pid test" local session_name=shm_path_per_pid local channel_name=channel_per_pid - local shm_path=$(mktemp -d) + local shm_path=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_shm.XXXXXX") # Build up start_lttng_sessiond @@ -165,7 +165,9 @@ function test_shm_path_per_uid() diag "Shm: ust per-uid test" local session_name=shm_path_per_uid local channel_name=channel_per_uid - local shm_path=$(mktemp -d) + set -x + local shm_path=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_shm_path.XXXXXX") + set +x # Build up start_lttng_sessiond @@ -216,8 +218,8 @@ function test_lttng_crash() diag "Lttng-crash: basic recuperation" local session_name=crash_test local channel_name=channel_crash - local shm_path=$(mktemp -d) - local shm_path_symlink=$(mktemp -d) + local shm_path=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_shm_path.XXXXXX") + local shm_path_symlink=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_shm_path_symlink.XXXXXX") local event_name="tp:tptest" # Create a session in snapshot mode to deactivate any use of consumerd @@ -253,8 +255,8 @@ function test_lttng_crash_extraction() diag "Lttng-crash: extraction to path" local session_name=crash_test local channel_name=channel_crash - local shm_path=$(mktemp -d) - local extraction_dir_path=$(mktemp -d) + local shm_path=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_shm_path.XXXXXX") + local extraction_dir_path=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_extraction_dir_path.XXXXXX") local extraction_path=$extraction_dir_path/extract local event_name="tp:tptest" @@ -287,7 +289,7 @@ function test_shm_path_per_pid_sigint() diag "Shm: ust per-pid test sigint" local session_name=shm_path_per_pid local channel_name=channel_per_pid - local shm_path=$(mktemp -d) + local shm_path=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_shm_path.XXXXXX") local num_files=0 # Build up @@ -318,7 +320,7 @@ function test_shm_path_per_uid_sigint() diag "Shm: ust per-uid test sigint" local session_name=shm_path_per_uid_sigint local channel_name=channel_per_uid_sigint - local shm_path=$(mktemp -d) + local shm_path=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_shm_path.XXXXXX") local ret=0 # Build up @@ -349,8 +351,8 @@ function test_lttng_crash_extraction_sigkill() diag "Lttng-crash: extraction with sigkill" local session_name=crash_test local channel_name=channel_crash - local shm_path=$(mktemp -d) - local extraction_dir_path=$(mktemp -d) + local shm_path=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_shm_path.XXXXXX") + local extraction_dir_path=$(mktemp -d --tmpdir "tmp.${FUNCNAME[0]}_extraction_dir_path.XXXXXX") local extraction_path=$extraction_dir_path/extract local event_name="tp:tptest" local ret=0 @@ -392,8 +394,8 @@ function interrupt_cleanup() } TESTS=( - test_shm_path_per_uid test_shm_path_per_pid + test_shm_path_per_uid test_shm_path_per_pid_sigint test_shm_path_per_uid_sigint test_lttng_crash diff --git a/tests/regression/tools/exclusion/test_exclusion b/tests/regression/tools/exclusion/test_exclusion index ce5e988e5..1bfb63533 100755 --- a/tests/regression/tools/exclusion/test_exclusion +++ b/tests/regression/tools/exclusion/test_exclusion @@ -40,7 +40,7 @@ function run_apps # of our test suite to generate events. function dry_run { - trace_path=$(mktemp -d) + local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") # Create session create_lttng_session_ok $SESSION_NAME $trace_path @@ -68,9 +68,9 @@ function dry_run function test_exclusion { - exclusions="$1" - event_name_expected_to_be_missing="$2" - trace_path=$(mktemp -d) + local exclusions="$1" + local event_name_expected_to_be_missing="$2" + local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") # Create session create_lttng_session_ok $SESSION_NAME $trace_path @@ -99,9 +99,9 @@ function test_exclusion_tracing_started { local exclusions="$1" local event_name_expected_to_be_missing="$2" - local trace_path=$(mktemp -d) - local file_wait_before_first=$(mktemp -u) - local file_create_in_main=$(mktemp -u) + local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + local file_wait_before_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_first.XXXXXX") + local file_create_in_main=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_create_in_main.XXXXXX") # Create session create_lttng_session_ok $SESSION_NAME $trace_path diff --git a/tests/regression/tools/filtering/test_invalid_filter b/tests/regression/tools/filtering/test_invalid_filter index 074786331..7d9e524d9 100755 --- a/tests/regression/tools/filtering/test_invalid_filter +++ b/tests/regression/tools/filtering/test_invalid_filter @@ -24,7 +24,7 @@ TESTDIR=$CURDIR/../../.. SESSION_NAME="filter-invalid" EVENT_NAME="bogus" ENABLE_EVENT_STDERR="/tmp/invalid-filters-stderr" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_filtering_invalid_filters_trace_path.XXXXXX) NUM_GLOBAL_TESTS=2 NUM_UST_TESTS=138 NUM_KERNEL_TESTS=138 diff --git a/tests/regression/tools/filtering/test_unsupported_op b/tests/regression/tools/filtering/test_unsupported_op index 3cba17186..299247a3c 100755 --- a/tests/regression/tools/filtering/test_unsupported_op +++ b/tests/regression/tools/filtering/test_unsupported_op @@ -12,7 +12,7 @@ TESTDIR=$CURDIR/../../.. SESSION_NAME="filter-unsupported-ops" EVENT_NAME="bogus" ENABLE_EVENT_STDERR="/tmp/unsupported-ops-enable" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_filtering_unsupported_ops_trace_path.XXXXXX) NUM_GLOBAL_TESTS=2 NUM_UST_TESTS=20 NUM_KERNEL_TESTS=20 diff --git a/tests/regression/tools/filtering/test_valid_filter b/tests/regression/tools/filtering/test_valid_filter index cfd8de3bf..e76ffa25f 100755 --- a/tests/regression/tools/filtering/test_valid_filter +++ b/tests/regression/tools/filtering/test_valid_filter @@ -94,11 +94,10 @@ function test_valid_filter event_name="$3" filter="$4" validator="$5" + local trace_path=$(mktemp --tmpdir -d tmp.test_filtering_invalid_filters_trace_path.XXXXXX) diag "Test valid $domain_name filter: $filter" - trace_path=$(mktemp -d) - # Create session create_lttng_session_ok $SESSION_NAME $trace_path diff --git a/tests/regression/tools/health/test_health.sh b/tests/regression/tools/health/test_health.sh index c59bab782..b3d6419d2 100644 --- a/tests/regression/tools/health/test_health.sh +++ b/tests/regression/tools/health/test_health.sh @@ -271,10 +271,10 @@ TEST_RELAYD=( 1 ) -STDOUT_PATH=$(mktemp) -STDERR_PATH=$(mktemp) -TRACE_PATH=$(mktemp -d) -HEALTH_PATH=$(mktemp -d) +STDOUT_PATH=$(mktemp --tmpdir tmp.test_health_stdout_path.XXXXXX) +STDERR_PATH=$(mktemp --tmpdir tmp.test_health_stderr_path.XXXXXX) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_health_trace_path.XXXXXX) +HEALTH_PATH=$(mktemp --tmpdir -d tmp.test_health_trace_path.XXXXXX) if [ "$(id -u)" == "0" ]; then isroot=1 diff --git a/tests/regression/tools/health/test_thread_ok b/tests/regression/tools/health/test_thread_ok index 1483fa70a..e84adb611 100755 --- a/tests/regression/tools/health/test_thread_ok +++ b/tests/regression/tools/health/test_thread_ok @@ -110,10 +110,10 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -STDOUT_PATH=$(mktemp) -STDERR_PATH=$(mktemp) -TRACE_PATH=$(mktemp -d) -HEALTH_PATH=$(mktemp -d) +STDOUT_PATH=$(mktemp --tmpdir tmp.test_thread_ok_stdout_path.XXXXXX) +STDERR_PATH=$(mktemp --tmpdir tmp.test_thread_ok_stderr_path.XXXXXX) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_thread_ok_trace_path.XXXXXX) +HEALTH_PATH=$(mktemp --tmpdir -d tmp.test_thread_ok_trace_path.XXXXXX) # The manage kernel thread is only spawned if we are root if [ "$(id -u)" == "0" ]; then diff --git a/tests/regression/tools/live/test_kernel b/tests/regression/tools/live/test_kernel index 25cb0eda1..58fe34936 100755 --- a/tests/regression/tools/live/test_kernel +++ b/tests/regression/tools/live/test_kernel @@ -16,7 +16,7 @@ DELAY_USEC=2000000 SESSION_NAME="live" EVENT_NAME="lttng_test_filter_event" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_live_kernel_trace_path.XXXXXX) DIR=$(readlink -f $TESTDIR) diff --git a/tests/regression/tools/live/test_lttng_kernel b/tests/regression/tools/live/test_lttng_kernel index 010ff855a..a23d9373a 100755 --- a/tests/regression/tools/live/test_lttng_kernel +++ b/tests/regression/tools/live/test_lttng_kernel @@ -14,7 +14,7 @@ DELAY_USEC=2000000 SESSION_NAME="live" EVENT_NAME="lttng_test_filter_event" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_lttng_live_kernel_trace_path.XXXXXX) DIR=$(readlink -f $TESTDIR) diff --git a/tests/regression/tools/live/test_lttng_ust b/tests/regression/tools/live/test_lttng_ust index 73164551e..aceb08e41 100755 --- a/tests/regression/tools/live/test_lttng_ust +++ b/tests/regression/tools/live/test_lttng_ust @@ -19,7 +19,7 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" SESSION_NAME="live" EVENT_NAME="tp:tptest" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_test_live_lttng_ust_trace_path.XXXXXX) DIR=$(readlink -f $TESTDIR) diff --git a/tests/regression/tools/live/test_ust b/tests/regression/tools/live/test_ust index 1de9ad598..45761c5c9 100755 --- a/tests/regression/tools/live/test_ust +++ b/tests/regression/tools/live/test_ust @@ -19,7 +19,7 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" SESSION_NAME="live" EVENT_NAME="tp:tptest" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_live_ust_trace_path.XXXXXX) DIR=$(readlink -f $TESTDIR) @@ -44,7 +44,7 @@ function clean_live_tracing() rm -rf $TRACE_PATH } -file_sync_after_first=$(mktemp -u) +file_sync_after_first=$(mktemp --tmpdir -u tmp.test_live_ust_sync_after_first.XXXXXX) start_lttng_sessiond_notap start_lttng_relayd_notap "-o $TRACE_PATH" diff --git a/tests/regression/tools/live/test_ust_tracefile_count b/tests/regression/tools/live/test_ust_tracefile_count index 5762d65c3..d576f3506 100755 --- a/tests/regression/tools/live/test_ust_tracefile_count +++ b/tests/regression/tools/live/test_ust_tracefile_count @@ -19,7 +19,7 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" SESSION_NAME="live" EVENT_NAME="tp:tptest" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_ust_trace_file_count_trace_path.XXXXXX) DIR=$(readlink -f $TESTDIR) @@ -45,7 +45,7 @@ function clean_live_tracing() rm -rf $TRACE_PATH } -file_sync_after_first=$(mktemp -u) +file_sync_after_first=$(mktemp --tmpdir -u tmp.test_ust_trace_file_count_sync_after_first.XXXXXX) start_lttng_sessiond_notap start_lttng_relayd_notap "-o $TRACE_PATH" diff --git a/tests/regression/tools/metadata/test_kernel b/tests/regression/tools/metadata/test_kernel index 630fe2d4a..57cace6ea 100755 --- a/tests/regression/tools/metadata/test_kernel +++ b/tests/regression/tools/metadata/test_kernel @@ -10,7 +10,7 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../.. EVENT_NAME="lttng_test_filter_event" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_metadata_env_kernel_trace_path.XXXXXX) NUM_TESTS=13 @@ -21,16 +21,13 @@ source "$CURDIR/utils.sh" function test_kernel () { - local metadata - local metadata_env local metadata_path local value local expected_path="${TRACE_PATH}/lttng-traces" local session_name="kernel" - - metadata=$(mktemp) - metadata_env=$(mktemp) + local metadata=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_metadata.XXXXXX") + local metadata_env=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_metadata_env.XXXXXX") diag "Test Kernel metadata env field" create_lttng_session_ok "$session_name" diff --git a/tests/regression/tools/metadata/test_ust b/tests/regression/tools/metadata/test_ust index ba34b7f4c..810a226cf 100755 --- a/tests/regression/tools/metadata/test_ust +++ b/tests/regression/tools/metadata/test_ust @@ -13,7 +13,7 @@ TESTAPP_NAME="gen-ust-events" TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" EVENT_NAME="tp:tptest" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_metadata_env_ust_trace_path.XXXXXX) NUM_TESTS=37 @@ -31,17 +31,14 @@ fi function test_per_uid () { - local metadata - local metadata_env local metadata_path local value local value2 local expected_path="${TRACE_PATH}/lttng-traces" local session_name="per-uid" - - metadata=$(mktemp) - metadata_env=$(mktemp) + local metadata=$(mktemp --tmpdir tmp.test_${FUNCNAME[0]}_metadata.XXXXXX) + local metadata_env=$(mktemp --tmpdir tmp.test_${FUNCNAME[0]}_metadata_env.XXXXXX) diag "Test UST metadata env field in per-uid mode" create_lttng_session_ok "$session_name" @@ -121,8 +118,6 @@ function test_per_uid () function test_per_pid () { - local metadata - local metadata_env local metadata_path local testapp_pid local value @@ -130,9 +125,8 @@ function test_per_pid () local expected_path="${TRACE_PATH}/lttng-traces" local session_name="per-pid" - - metadata=$(mktemp) - metadata_env=$(mktemp) + local metadata=$(mktemp --tmpdir tmp.test_${FUNCNAME[0]}_metadata.XXXXXX) + local metadata_env=$(mktemp --tmpdir tmp.test_${FUNCNAME[0]}_metadata_env.XXXXXX) diag "Test UST metadata env field in per-pid mode" create_lttng_session_ok "$session_name" diff --git a/tests/regression/tools/mi/test_mi b/tests/regression/tools/mi/test_mi index 46a9e9180..db5dec50e 100755 --- a/tests/regression/tools/mi/test_mi +++ b/tests/regression/tools/mi/test_mi @@ -18,8 +18,8 @@ NR_USEC_WAIT=0 NR_ITER=10000 #Temp file output -OUTPUT_DIR=$(mktemp -d) -SESSIOND_LOAD_DIR=$(mktemp -d) +OUTPUT_DIR=$(mktemp --tmpdir -d tmp.test_mi_output_dir.XXXXXX) +SESSIOND_LOAD_DIR=$(mktemp --tmpdir -d tmp.test_mi_sessiond_load_dir.XXXXXX) OUTPUT_FILE="default.xml" #Path to custom xml utilities @@ -524,8 +524,8 @@ function test_list_session () function test_list_ust_event () { - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") OUTPUT_FILE="list_ust_event.xml" diff --git a/tests/regression/tools/notification/test_notification_kernel_buffer_usage b/tests/regression/tools/notification/test_notification_kernel_buffer_usage index 17b8d765d..76e69a77e 100755 --- a/tests/regression/tools/notification/test_notification_kernel_buffer_usage +++ b/tests/regression/tools/notification/test_notification_kernel_buffer_usage @@ -7,13 +7,13 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) +TEST_TMPDIR=$(mktemp --tmpdir -d tmp.test_notif_kernel_buffer_usage_dir.XXXXXX) #This is needed since the testpoint create a pipe with the consumerd type suffixed -TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n") -TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX") +TESTPOINT_BASE_PATH=$(readlink -f "$TEST_TMPDIR/lttng.t_p_n") +TESTPOINT_PIPE_PATH=$(mktemp -u --tmpdir="$TEST_TMPDIR" "lttng.t_p_n.XXXXXX") TESTPOINT=$(readlink -f "${CURDIR}/.libs/libpause_consumer.so") -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp -u --tmpdir="$TEST_TMPDIR" "application_state.XXXXXXXXXX") SESSION_NAME="my_session" @@ -33,7 +33,7 @@ function test_buffer_usage_notification local page_size local consumerd_pipe=() - trace_path=$(mktemp -d) + trace_path=$(mktemp -d --tmpdir="$TEST_TMPDIR" "tmp.${FUNCNAME[0]}_trace_path.XXXXXXX") page_size=$(getconf PAGE_SIZE) create_lttng_session_notap $SESSION_NAME "$trace_path" @@ -85,4 +85,4 @@ else skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS fi -rm -rf "$TMPDIR" +rm -rf "$TEST_TMPDIR" diff --git a/tests/regression/tools/notification/test_notification_kernel_capture b/tests/regression/tools/notification/test_notification_kernel_capture index 9b6e7ac57..88f123d3d 100755 --- a/tests/regression/tools/notification/test_notification_kernel_capture +++ b/tests/regression/tools/notification/test_notification_kernel_capture @@ -7,10 +7,8 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) - TESTAPP_PATH="$TESTDIR/utils/testapp" -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp --tmpdir -u "tmp.test_notif_kernel_capture_application_state.XXXXXXXXXX") NUM_TESTS=104 @@ -51,5 +49,4 @@ else skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS fi -# Just in case cleanup -rm -rf "$TMPDIR" +rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_error b/tests/regression/tools/notification/test_notification_kernel_error index 746f98112..80fe6e5b5 100755 --- a/tests/regression/tools/notification/test_notification_kernel_error +++ b/tests/regression/tools/notification/test_notification_kernel_error @@ -7,10 +7,8 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) - TESTAPP_PATH="$TESTDIR/utils/testapp" -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp --tmpdir -u "tmp.test_notif_kernel_error_application_state.XXXXXXXXXX") NUM_TESTS=44 @@ -51,5 +49,4 @@ else skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS fi -# Just in case cleanup -rm -rf "$TMPDIR" +rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_instrumentation b/tests/regression/tools/notification/test_notification_kernel_instrumentation index ef4efbce7..90545a541 100755 --- a/tests/regression/tools/notification/test_notification_kernel_instrumentation +++ b/tests/regression/tools/notification/test_notification_kernel_instrumentation @@ -7,9 +7,7 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) - -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp --tmpdir -u "tmp.test_notif_kernel_instrumentation_application_state.XXXXXXXXXX") NUM_TESTS=13 @@ -48,4 +46,4 @@ else skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS fi -rm -rf "$TMPDIR" +rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_syscall b/tests/regression/tools/notification/test_notification_kernel_syscall index 62c1e74d7..d273cb55d 100755 --- a/tests/regression/tools/notification/test_notification_kernel_syscall +++ b/tests/regression/tools/notification/test_notification_kernel_syscall @@ -7,9 +7,7 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) - -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp --tmpdir -u "tmp.test_notif_kernel_syscall_application_state.XXXXXX") NUM_TESTS=25 @@ -48,5 +46,4 @@ else skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS fi -# Just in case cleanup -rm -rf "$TMPDIR" +rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_kernel_userspace_probe b/tests/regression/tools/notification/test_notification_kernel_userspace_probe index fba14062f..8ef8d708d 100755 --- a/tests/regression/tools/notification/test_notification_kernel_userspace_probe +++ b/tests/regression/tools/notification/test_notification_kernel_userspace_probe @@ -7,9 +7,7 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) - -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp --tmpdir -u "tmp.test_notif_kernel_uprobe_application_state.XXXXXXXXXX") NUM_TESTS=13 @@ -45,5 +43,4 @@ else skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS fi -# Just in case cleanup -rm -rf "$TMPDIR" +rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_multi_app b/tests/regression/tools/notification/test_notification_multi_app index 7f24ef893..d8b639225 100755 --- a/tests/regression/tools/notification/test_notification_multi_app +++ b/tests/regression/tools/notification/test_notification_multi_app @@ -14,7 +14,7 @@ TESTPOINT=$(readlink -f ${CURDIR}/.libs/libpause_consumer.so) TESTAPP_PATH="$TESTDIR/utils/testapp" TESTAPP_NAME="gen-ust-events" TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" -TESTAPP_STATE_FILE="$(mktemp -u)" +TESTAPP_STATE_FILE="$(mktemp --tmpdir -u tmp.test_notification_multi_app_state_file.XXXXXX)" NR_ITER=1000 NR_USEC_WAIT=5 @@ -35,7 +35,7 @@ source $TESTDIR/utils/utils.sh source $CURDIR/util_event_generator.sh consumerd_pipe=() -file_sync_after_first_event=$(mktemp -u) +file_sync_after_first_event=$(mktemp --tmpdir -u tmp.test_notification_multi_app_sync_after_first.XXXXXX) # MUST set TESTDIR before calling those functions plan_tests $NUM_TESTS @@ -135,10 +135,10 @@ function test_multi_app () local app_pids=() local low_output_file_pattern="low_app_output_file_" local high_output_file_pattern="high_app_output_file_" - local output_dir=$(mktemp -d) + local output_dir=$(mktemp --tmpdir -d "tmp.test_${FUNCNAME[0]}_output_dir.XXXXXX") local testpoint_base_path=$(readlink -f "$output_dir/lttng.t_p_n_multi_app") - local testpoint_pipe_path=$(mktemp -u "${testpoint_base_path}.XXXXXX") + local testpoint_pipe_path=$(mktemp --tmpdir="$output_dir" -u "lttng.t_p_n_multi_app.XXXXXX") local nr_notification_expected=5 local nr_client_app=50 @@ -325,9 +325,9 @@ function test_on_register_evaluation () local app_pids=() local high_output_file_pattern="high_app_output_file_on_register_evaluation" - local output_dir=$(mktemp -d) + local output_dir=$(mktemp --tmpdir -d "tmp.test_${FUNCNAME[0]}_output_dir.XXXXXX") local testpoint_base_path=$(readlink -f "$output_dir/lttng.t_p_n_register_evaluation") - local testpoint_pipe_path=$(mktemp -u "${testpoint_base_path}.XXXXXX") + local testpoint_pipe_path=$(mktemp --tmpdir="$output_dir" -u "lttng.t_p_n_register_evaluation.XXXXXX") local domain_string="" local event_name="" @@ -430,7 +430,7 @@ fi for fct_test in ${TESTS[@]}; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_notification_multi_app_trace_path.XXXXXX) ${fct_test} if [ $? -ne 0 ]; then diff --git a/tests/regression/tools/notification/test_notification_notifier_discarded_count b/tests/regression/tools/notification/test_notification_notifier_discarded_count index 5f2754362..3e25d169f 100755 --- a/tests/regression/tools/notification/test_notification_notifier_discarded_count +++ b/tests/regression/tools/notification/test_notification_notifier_discarded_count @@ -7,14 +7,14 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) +TEST_TMPDIR=$(mktemp --tmpdir -d tmp.test_notifier_discarded_count.XXXXXX) TESTAPP_PATH="$TESTDIR/utils/testapp" TESTAPP_NAME="gen-ust-events" TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" -TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n") -TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX") +TESTPOINT_BASE_PATH=$(readlink -f "$TEST_TMPDIR/lttng.t_p_n") +TESTPOINT_PIPE_PATH=$(mktemp -u --tmpdir="$TEST_TMPDIR" "lttng.t_p_n.XXXXXX") TESTPOINT=$(readlink -f "${CURDIR}/.libs/libpause_sessiond.so") SH_TAP=1 @@ -37,7 +37,7 @@ plan_tests $NUM_TESTS function trigger_get_discarded_notif_number() { local trigger_name="$1" - local list_triggers_stdout=$(mktemp -t list_triggers_stdout.XXXXXX) + local list_triggers_stdout=$(mktemp --tmpdir="$TEST_TMPDIR" "list_triggers_stdout.XXXXXX") "$FULL_LTTNG_BIN" list-triggers > "$list_triggers_stdout" @@ -60,7 +60,7 @@ function test_kernel_notifier_discarded_count { local sessiond_pipe=() local trigger_name="my_trigger" - local list_triggers_stdout=$(mktemp -t list_triggers_stdout.XXXXXX) + local list_triggers_stdout=$(mktemp --tmpdir="$TEST_TMPDIR" "list_triggers_stdout.XXXXXX") # Used on sessiond launch. LTTNG_SESSIOND_ENV_VARS="LTTNG_TESTPOINT_ENABLE=1 \ @@ -244,7 +244,7 @@ function test_ust_notifier_discarded_count_multi_uid local sessiond_pipe=() local root_trigger_name="root_trigger" local user_trigger_name="user_trigger" - local list_triggers_stdout=$(mktemp -t list_triggers_stdout.XXXXXX) + local list_triggers_stdout=$(mktemp --tmpdir="$TEST_TMPDIR" "list_triggers_stdout.XXXXXX") local NR_USEC_WAIT=0 local PIPE_SIZE local NR_ITER @@ -324,7 +324,7 @@ function test_ust_notifier_discarded_regardless_trigger_owner local sessiond_pipe=() local root_trigger_name="root_trigger" local user_trigger_name="user_trigger" - local list_triggers_stdout=$(mktemp -t list_triggers_stdout.XXXXXX) + local list_triggers_stdout=$(mktemp --tmpdir="$TEST_TMPDIR" "list_triggers_stdout.XXXXXX") local NR_USEC_WAIT=0 local PIPE_SIZE local NR_ITER @@ -418,4 +418,4 @@ else skip 0 "Root access is needed. Skipping all kernel notification tests." $KERNEL_NUM_TESTS fi -rm -rf "$TMPDIR" +rm -f "$TEST_TMPDIR" diff --git a/tests/regression/tools/notification/test_notification_ust_buffer_usage b/tests/regression/tools/notification/test_notification_ust_buffer_usage index a8b96bb33..4a4c14f3a 100755 --- a/tests/regression/tools/notification/test_notification_ust_buffer_usage +++ b/tests/regression/tools/notification/test_notification_ust_buffer_usage @@ -7,11 +7,12 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) +TEST_TMPDIR=$(mktemp --tmpdir -d tmp.test_notif_ust_buffer_usage_dir.XXXXXX) +set -x #This is needed since the testpoint create a pipe with the consumerd type suffixed -TESTPOINT_BASE_PATH=$(readlink -f "$TMPDIR/lttng.t_p_n") -TESTPOINT_PIPE_PATH=$(mktemp -u "${TESTPOINT_BASE_PATH}.XXXXXX") +TESTPOINT_BASE_PATH=$(readlink -f "$TEST_TMPDIR/lttng.t_p_n") +TESTPOINT_PIPE_PATH=$(mktemp -u --tmpdir="$TEST_TMPDIR" "lttng.t_p_n.XXXXXX") TESTPOINT=$(readlink -f "${CURDIR}/.libs/libpause_consumer.so") TESTAPP_PATH="$TESTDIR/utils/testapp" @@ -19,13 +20,14 @@ TESTAPP_PATH="$TESTDIR/utils/testapp" GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events" GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME" -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp -u --tmpdir="$TEST_TMPDIR" "application_state.XXXXXXXXXX") SESSION_NAME="my_session" CHANNEL_NAME="my_channel" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp -d --tmpdir="$TEST_TMPDIR" "trace_path.XXXXXX") PAGE_SIZE=$(getconf PAGE_SIZE) +set +x # shellcheck source=../../../utils/utils.sh source "$TESTDIR/utils/utils.sh" @@ -71,4 +73,4 @@ test_buffer_usage_notification stop_lttng_sessiond_notap -rm -rf "$TMPDIR" +rm -rf "$TEST_TMPDIR" diff --git a/tests/regression/tools/notification/test_notification_ust_capture b/tests/regression/tools/notification/test_notification_ust_capture index 820116ac1..3546d32ec 100755 --- a/tests/regression/tools/notification/test_notification_ust_capture +++ b/tests/regression/tools/notification/test_notification_ust_capture @@ -7,14 +7,12 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) - TESTAPP_PATH="$TESTDIR/utils/testapp" GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events" GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME" -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp --tmpdir -u "tmp.test_notif_ust_capture_application_state.XXXXXX") # shellcheck source=../../../utils/utils.sh source "$TESTDIR/utils/utils.sh" @@ -39,4 +37,4 @@ test_basic_error_path stop_lttng_sessiond_notap -rm -rf "$TMPDIR" +rm -f "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_notification_ust_error b/tests/regression/tools/notification/test_notification_ust_error index c62fe55eb..dead31059 100755 --- a/tests/regression/tools/notification/test_notification_ust_error +++ b/tests/regression/tools/notification/test_notification_ust_error @@ -7,14 +7,13 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) TESTAPP_PATH="$TESTDIR/utils/testapp" GEN_UST_EVENTS_TESTAPP_NAME="gen-ust-events" GEN_UST_EVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_EVENTS_TESTAPP_NAME/$GEN_UST_EVENTS_TESTAPP_NAME" -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp --tmpdir -u "tmp.test_notif_ust_error_application_state.XXXXXX") # shellcheck source=../../../utils/utils.sh source "$TESTDIR/utils/utils.sh" @@ -38,4 +37,4 @@ test_basic_error_path stop_lttng_sessiond_notap -rm -rf "$TMPDIR" +rm -f $TESTAPP_STATE_PATH diff --git a/tests/regression/tools/notification/test_notification_ust_event_rule_condition_exclusion b/tests/regression/tools/notification/test_notification_ust_event_rule_condition_exclusion index 12ae728bb..c15ecff08 100755 --- a/tests/regression/tools/notification/test_notification_ust_event_rule_condition_exclusion +++ b/tests/regression/tools/notification/test_notification_ust_event_rule_condition_exclusion @@ -7,14 +7,12 @@ CURDIR=$(dirname "$0")/ TESTDIR=$CURDIR/../../../ -TMPDIR=$(mktemp -d) - TESTAPP_PATH="$TESTDIR/utils/testapp" GEN_UST_NEVENTS_TESTAPP_NAME="gen-ust-nevents" GEN_UST_NEVENTS_TESTAPP_BIN="$TESTAPP_PATH/$GEN_UST_NEVENTS_TESTAPP_NAME/$GEN_UST_NEVENTS_TESTAPP_NAME" -TESTAPP_STATE_PATH=$(mktemp -u "$TMPDIR/application_state.XXXXXXXXXX") +TESTAPP_STATE_PATH=$(mktemp --tmpdir -u "tmp.test_notif_event_rule_exclusion_ust_application_state.XXXXXX") # shellcheck source=../../../utils/utils.sh source "$TESTDIR/utils/utils.sh" @@ -38,4 +36,4 @@ test_event_rule_condition_exclusion_notification stop_lttng_sessiond_notap -rm -rf "$TMPDIR" +rm -rf "$TESTAPP_STATE_PATH" diff --git a/tests/regression/tools/notification/test_rotation b/tests/regression/tools/notification/test_rotation index 020d7c489..90f788786 100755 --- a/tests/regression/tools/notification/test_rotation +++ b/tests/regression/tools/notification/test_rotation @@ -12,14 +12,13 @@ TESTAPP_NAME="gen-ust-events" TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" SESSION_NAME="my_session" -TMP_DIR=$(mktemp -d) -SESSION_OUTPUT_PATH=$TMP_DIR/output +SESSION_OUTPUT_PATH=$(mktemp --tmpdir -d tmp.test_notif_rotation_trace_path.XXXXXX) EVENT_NAME="tp:tptest" PAGE_SIZE=$(getconf PAGE_SIZE) SUBBUF_SIZE=$(expr $PAGE_SIZE \* 8) -FILE_SYNC_AFTER_FIRST_EVENT=$(mktemp -u) +FILE_SYNC_AFTER_FIRST_EVENT=$(mktemp --tmpdir -u tmp.test_rotation_sync_after_first.XXXXXX) NR_ITER=-1 NR_USEC_WAIT=5 @@ -58,5 +57,5 @@ stop_lttng_sessiond_notap kill -9 $APP_PID wait $APP_PID 2> /dev/null -rm -rf $TMP_DIR -rm $FILE_SYNC_AFTER_FIRST_EVENT 2> /dev/null +rm -rf $SESSION_OUTPUT_PATH +rm -f $FILE_SYNC_AFTER_FIRST_EVENT diff --git a/tests/regression/tools/regen-metadata/test_kernel b/tests/regression/tools/regen-metadata/test_kernel index 3056e3904..840be8e85 100755 --- a/tests/regression/tools/regen-metadata/test_kernel +++ b/tests/regression/tools/regen-metadata/test_kernel @@ -11,7 +11,7 @@ TESTDIR=$CURDIR/../../.. EVENT_NAME="lttng_test_filter_event" SESSION_NAME="" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_regen_metadata_kernel_trace_path.XXXXXX) NUM_TESTS=24 diff --git a/tests/regression/tools/regen-metadata/test_ust b/tests/regression/tools/regen-metadata/test_ust index d23b4f203..cc3aed9cf 100755 --- a/tests/regression/tools/regen-metadata/test_ust +++ b/tests/regression/tools/regen-metadata/test_ust @@ -16,7 +16,7 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" SESSION_NAME="stream" EVENT_NAME="tp:tptest" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_regen_metadata_ust_trace_path.XXXXXX) NUM_TESTS=39 @@ -39,8 +39,8 @@ function enable_channel_per_pid() function test_ust_streaming () { - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") local metadata_path diag "Test UST streaming with metadata regeneration" @@ -83,8 +83,8 @@ function test_ust_streaming () function test_ust_local () { - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") local metadata_path diag "Test UST local with metadata regeneration" @@ -127,8 +127,8 @@ function test_ust_local () function test_ust_pid () { - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") diag "Test UST per-pid with metadata regeneration (expect failure)" create_lttng_session_ok $SESSION_NAME $TRACE_PATH @@ -161,8 +161,8 @@ function test_ust_pid () function test_ust_live () { - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") diag "Test UST live with metadata regeneration (expect failure)" create_lttng_session_uri $SESSION_NAME net://localhost --live diff --git a/tests/regression/tools/regen-statedump/test_kernel b/tests/regression/tools/regen-statedump/test_kernel index 00c7d76ce..8a261355d 100755 --- a/tests/regression/tools/regen-statedump/test_kernel +++ b/tests/regression/tools/regen-statedump/test_kernel @@ -12,7 +12,7 @@ EVENT_NAME="lttng_test_filter_event" SESSION_NAME="" EVENT_NAME="lttng_statedump_start,lttng_statedump_end" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_regenerate_statedump_kernel_trace_path.XXXXXX) NUM_TESTS=11 diff --git a/tests/regression/tools/regen-statedump/test_ust b/tests/regression/tools/regen-statedump/test_ust index 09d0d8fc7..8572e2545 100755 --- a/tests/regression/tools/regen-statedump/test_ust +++ b/tests/regression/tools/regen-statedump/test_ust @@ -16,7 +16,7 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" SESSION_NAME="stream" EVENT_NAME="lttng_ust_statedump:start,lttng_ust_statedump:end" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_regenerate_statedump_ust_trace_path.XXXXXX) NUM_TESTS=11 @@ -28,8 +28,8 @@ fi function test_ust_local () { - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u tmp.test_${FUNCNAME[0]}_sync_after_first.XXXXXX) + local file_sync_before_last=$(mktemp --tmpdir -u tmp.test_${FUNCNAME[0]}_sync_before_last.XXXXXX) diag "Test UST local with statedump regeneration" create_lttng_session_ok $SESSION_NAME $TRACE_PATH diff --git a/tests/regression/tools/relayd-grouping/test_ust b/tests/regression/tools/relayd-grouping/test_ust index 1b1299b90..565950b18 100755 --- a/tests/regression/tools/relayd-grouping/test_ust +++ b/tests/regression/tools/relayd-grouping/test_ust @@ -40,7 +40,7 @@ function get_auto_session_name () local lttng_bin=$LTTNG_BIN LTTNG_BIN="${lttng_bin} --mi xml" - OUTPUT_DEST=$(mktemp) + OUTPUT_DEST=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_output.XXXXXX") list_lttng_with_opts $XML_VALIDATE "$OUTPUT_DEST" @@ -462,8 +462,8 @@ function test_ust_pid_streaming_snapshot () local file_sync_after_first local file_sync_before_last - file_sync_after_first=$(mktemp -u) - file_sync_before_last=$(mktemp -u) + file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") if [ -z "$session_name" ]; then is_automatic_session=true @@ -676,7 +676,7 @@ for fct_test in "${tests[@]}"; do for grouping in "${grouping_types[@]}"; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_relayd_grouping_ust_trace_path.XXXXXX) # Set the relayd in --group-output-by-session mode start_lttng_relayd "-o $TRACE_PATH $grouping" start_lttng_sessiond diff --git a/tests/regression/tools/rotation/test_kernel b/tests/regression/tools/rotation/test_kernel index 7cd51bc03..f5f1f5553 100755 --- a/tests/regression/tools/rotation/test_kernel +++ b/tests/regression/tools/rotation/test_kernel @@ -10,7 +10,7 @@ CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../../.. EVENT_NAME="lttng_test_filter_event" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d -t tmp.rotation_kernel_tracing.XXXXXX) NUM_TESTS=60 diff --git a/tests/regression/tools/rotation/test_save_load_mi b/tests/regression/tools/rotation/test_save_load_mi index 24e1efc67..fc3b24891 100755 --- a/tests/regression/tools/rotation/test_save_load_mi +++ b/tests/regression/tools/rotation/test_save_load_mi @@ -33,9 +33,9 @@ XPATH_LIST_ROTATE_SIZE="$XPATH_SESSION/lttng:rotation_schedules/lttng:size_thres function test_save_load_mi () { - local tmp_xml_output=$(mktemp -u) - local tmp_save_output=$(mktemp -d) - local trace_path=$(mktemp -d) + local tmp_xml_output=$(mktemp --tmpdir -u -t "tmp.${FUNCNAME[0]}_xml_output.XXXXXX") + local tmp_save_output=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_save_output.XXXXXX") + local trace_path=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") diag "Test save/load/list/MI with rotation" create_lttng_session_ok $SESSION_NAME $trace_path diff --git a/tests/regression/tools/rotation/test_schedule_api b/tests/regression/tools/rotation/test_schedule_api index 42860f574..8b4f42d19 100755 --- a/tests/regression/tools/rotation/test_schedule_api +++ b/tests/regression/tools/rotation/test_schedule_api @@ -10,7 +10,7 @@ CURDIR=$(dirname $0)/ TESTDIR=$CURDIR/../../.. SESSION_NAME="my_session" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d -t tmp.rotation_schedule_api.XXXXXX) source $TESTDIR/utils/utils.sh diff --git a/tests/regression/tools/rotation/test_ust b/tests/regression/tools/rotation/test_ust index b6e0502c7..4d295d6e9 100755 --- a/tests/regression/tools/rotation/test_ust +++ b/tests/regression/tools/rotation/test_ust @@ -15,7 +15,7 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" SESSION_NAME="stream" EVENT_NAME="tp:tptest" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_ust_rotation_trace_path.XXXXXX) NUM_TESTS=136 diff --git a/tests/regression/tools/save-load/test_autoload b/tests/regression/tools/save-load/test_autoload index b9e15e959..0fbfa49f1 100755 --- a/tests/regression/tools/save-load/test_autoload +++ b/tests/regression/tools/save-load/test_autoload @@ -62,8 +62,8 @@ TESTS=( for fct_test in ${TESTS[@]}; do - export LTTNG_HOME=$(mktemp -d) - export LTTNG_DIR=$(mktemp -d) + export LTTNG_HOME=$(mktemp --tmpdir -d tmp.test_lttng_home_dir.XXXXXX) + export LTTNG_DIR=$(mktemp --tmpdir -d tmp.test_lttng_dir.XXXXXX) ${fct_test} rm -rf $LTTNG_DIR diff --git a/tests/regression/tools/save-load/test_load b/tests/regression/tools/save-load/test_load index 4f18dec2d..3cf0cc501 100755 --- a/tests/regression/tools/save-load/test_load +++ b/tests/regression/tools/save-load/test_load @@ -58,7 +58,7 @@ function test_complex_load() disable_ust_lttng_channel $sess chan3 # Confirm that an event stored as disabled is restored in its disabled state - local mi_output_file=$(mktemp) + local mi_output_file=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_output_file.XXXXXX") if [ $? -ne 0 ]; then break; fi @@ -127,7 +127,7 @@ function test_trackers() lttng_load_ok "-i $CURDIR/$SESSION_NAME-trackers.lttng" diag "Test pid tracker" - local mi_output_file=$(mktemp) + local mi_output_file=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_output_file.XXXXXX") if [ $? -ne 0 ]; then break; fi @@ -176,7 +176,7 @@ function test_override_url_normal() start_lttng_relayd "-C tcp://127.0.0.1:8172 -D tcp://127.0.0.1:9817" - local mi_output_file=$(mktemp) + local mi_output_file=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_output_file.XXXXXX") if [ $? -ne 0 ]; then break; fi @@ -226,7 +226,7 @@ function test_override_url_snapshot() start_lttng_relayd "-C tcp://127.0.0.1:8172 -D tcp://127.0.0.1:9817" - local mi_output_file=$(mktemp) + local mi_output_file=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_output_file.XXXXXX") if [ $? -ne 0 ]; then break; fi @@ -280,7 +280,7 @@ function test_override_url_live() start_lttng_relayd "-C tcp://127.0.0.1:8172 -D tcp://127.0.0.1:9817" - local mi_output_file=$(mktemp) + local mi_output_file=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_output_file.XXXXXX") if [ $? -ne 0 ]; then break; fi @@ -316,7 +316,7 @@ function test_override_session_name() local override_name="PinkyAndTheBrain" local output_path="/tmp/lttng/load-42-1" - local mi_output_file=$(mktemp) + local mi_output_file=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_output_file.XXXXXX") if [ $? -ne 0 ]; then break; fi @@ -362,7 +362,7 @@ TESTS=( for fct_test in ${TESTS[@]}; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_load_trace_path.XXXXXX) ${fct_test} if [ $? -ne 0 ]; then diff --git a/tests/regression/tools/save-load/test_save b/tests/regression/tools/save-load/test_save index 0f3e596a0..73527ec7b 100755 --- a/tests/regression/tools/save-load/test_save +++ b/tests/regression/tools/save-load/test_save @@ -134,7 +134,7 @@ TESTS=( for fct_test in ${TESTS[@]}; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_save_trace_path.XXXXXX) ${fct_test} if [ $? -ne 0 ]; then diff --git a/tests/regression/tools/snapshots/test_kernel b/tests/regression/tools/snapshots/test_kernel index d4e0008f9..8cac901e7 100755 --- a/tests/regression/tools/snapshots/test_kernel +++ b/tests/regression/tools/snapshots/test_kernel @@ -12,7 +12,7 @@ EVENT_NAME="sched_switch" SESSION_NAME="" CHANNEL_NAME="snapchan" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_snapshots_kernel_trace_path.XXXXXX) NUM_TESTS=2061 diff --git a/tests/regression/tools/snapshots/test_kernel_streaming b/tests/regression/tools/snapshots/test_kernel_streaming index 273bcdd04..0c92dc710 100755 --- a/tests/regression/tools/snapshots/test_kernel_streaming +++ b/tests/regression/tools/snapshots/test_kernel_streaming @@ -12,7 +12,7 @@ EVENT_NAME="sched_switch" SESSION_NAME="" CHANNEL_NAME="chan1" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_snapshots_kernel_streaming_trace_path.XXXXXX) NUM_TESTS=66 diff --git a/tests/regression/tools/snapshots/test_ust_streaming b/tests/regression/tools/snapshots/test_ust_streaming index 2b20ccaf0..ed109abd4 100755 --- a/tests/regression/tools/snapshots/test_ust_streaming +++ b/tests/regression/tools/snapshots/test_ust_streaming @@ -19,7 +19,7 @@ NR_ITER=-1 NR_USEC_WAIT=100 APPS_PID= -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_snapshots_ust_streaming_trace_path.XXXXXX) NUM_TESTS=85 @@ -47,7 +47,7 @@ function snapshot_add_output () # Start trace application and return once one event has been hit. function start_test_app() { - local tmp_file=$(mktemp -u) + local tmp_file=$(mktemp --tmpdir -u tmp.test_${FUNCNAME[0]}_tmp_file.XXXXXX) # Start application with a temporary file. $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $tmp_file & diff --git a/tests/regression/tools/snapshots/ust_test b/tests/regression/tools/snapshots/ust_test index 8daaa045d..54365c3ea 100755 --- a/tests/regression/tools/snapshots/ust_test +++ b/tests/regression/tools/snapshots/ust_test @@ -18,7 +18,7 @@ APPS_PID= NUM_TESTS=105 -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_snapshots_ust_trace_path.XXXXXX) source $TESTDIR/utils/utils.sh @@ -36,7 +36,7 @@ NUM_TESTS=$(($NUM_TESTS + ($NR_SNAPSHOT * 3))) function start_test_app() { - local tmp_file=$(mktemp -u) + local tmp_file=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_tmp_file.XXXXXX") # Start application with a temporary file. $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $tmp_file & diff --git a/tests/regression/tools/streaming/test_high_throughput_limits b/tests/regression/tools/streaming/test_high_throughput_limits index 352cf9aa6..2b9e3ad39 100755 --- a/tests/regression/tools/streaming/test_high_throughput_limits +++ b/tests/regression/tools/streaming/test_high_throughput_limits @@ -20,7 +20,7 @@ SESSIOND_CTRL_PORT=5342 SESSIOND_DATA_PORT=5343 DEFAULT_IF="lo" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_streaming_high_throughput_limits_trace_path.XXXXXX) NUM_TESTS=104 @@ -126,9 +126,8 @@ function test_high_throughput function validate_event_count { - - TEMP_FILE=$(mktemp) - TEMP_FILE_2=$(mktemp) + TEMP_FILE=$(mktemp --tmpdir tmp.streaming_high_throughput_limit_file1.XXXXXX) + TEMP_FILE_2=$(mktemp --tmpdir tmp.streaming_high_throughput_limit_file2.XXXXXX) traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l) babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2 diff --git a/tests/regression/tools/streaming/test_kernel b/tests/regression/tools/streaming/test_kernel index a7069ccb8..33334229f 100755 --- a/tests/regression/tools/streaming/test_kernel +++ b/tests/regression/tools/streaming/test_kernel @@ -11,7 +11,7 @@ TESTDIR=$CURDIR/../../.. EVENT_NAME="sched_switch" SESSION_NAME="" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_streaming_kernel_trace_path.XXXXXX) NUM_TESTS=11 diff --git a/tests/regression/tools/streaming/test_ust b/tests/regression/tools/streaming/test_ust index d030f1658..2e15bd4c6 100755 --- a/tests/regression/tools/streaming/test_ust +++ b/tests/regression/tools/streaming/test_ust @@ -16,7 +16,7 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" SESSION_NAME="stream" EVENT_NAME="tp:tptest" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_streaming_ust_trace_path.XXXXXX) NUM_TESTS=18 @@ -30,7 +30,7 @@ fi function test_ust_before_start () { - local file_sync_before_last=$(mktemp -u) + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.test_${FUNCNAME[0]}_sync_before_last.XXXXXX") diag "Test UST streaming BEFORE tracing starts" create_lttng_session_uri $SESSION_NAME net://localhost @@ -53,7 +53,7 @@ function test_ust_before_start () function test_ust_after_start () { - local file_sync_after_first=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.test_${FUNCNAME[0]}_sync_after_first.XXXXXX") diag "Test UST streaming AFTER tracing starts" create_lttng_session_uri $SESSION_NAME net://localhost diff --git a/tests/regression/tools/tracefile-limits/test_tracefile_count b/tests/regression/tools/tracefile-limits/test_tracefile_count index eb5d1a5f1..244910dd6 100755 --- a/tests/regression/tools/tracefile-limits/test_tracefile_count +++ b/tests/regression/tools/tracefile-limits/test_tracefile_count @@ -90,10 +90,9 @@ function test_tracefile_count_limit () local session_name local stream_pattern=".*${channel_name}_${cpuno}_[0-9]*" local stream_size=0 - local trace_path + local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") session_name=$(randstring 16 0) - trace_path=$(mktemp -d) diag "Test tracefile count limit : CPU $cpuno, $count_limit tracefiles, expecting a maximum of $expected_size bytes per CPU" diff --git a/tests/regression/tools/tracefile-limits/test_tracefile_size b/tests/regression/tools/tracefile-limits/test_tracefile_size index 481abc92b..bbfc27c9e 100755 --- a/tests/regression/tools/tracefile-limits/test_tracefile_size +++ b/tests/regression/tools/tracefile-limits/test_tracefile_size @@ -84,11 +84,11 @@ function check_file_size () function test_tracefile_size_limit () { - size_limit="$1" - trace_path=$(mktemp -d) - session_name=$(randstring 16 0) - channel_name="channel" - event_name="tp:tptest" + local size_limit="$1" + local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + local session_name=$(randstring 16 0) + local channel_name="channel" + local event_name="tp:tptest" diag "Test tracefile size limit : $size_limit bytes" @@ -124,11 +124,11 @@ function test_tracefile_size_limit () function test_tracefile_size_limit_pagesize () { # Set a size limit lower than the page_size - size_limit="$(($PAGE_SIZE-2))" - trace_path=$(mktemp -d) - session_name=$(randstring 16 0) - channel_name="channel" - event_name="tp:tptest" + local size_limit="$(($PAGE_SIZE-2))" + local trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + local session_name=$(randstring 16 0) + local channel_name="channel" + local event_name="tp:tptest" diag "Test tracefile size limit lower than PAGE_SIZE : $size_limit bytes" diff --git a/tests/regression/tools/tracker/test_event_tracker b/tests/regression/tools/tracker/test_event_tracker index 711690af6..feb378715 100755 --- a/tests/regression/tools/tracker/test_event_tracker +++ b/tests/regression/tools/tracker/test_event_tracker @@ -37,8 +37,8 @@ source $TESTDIR/utils/utils.sh function prepare_ust_app { - AFTER_FIRST_PATH=$(mktemp -u) - BEFORE_LAST_PATH=$(mktemp -u) + AFTER_FIRST_PATH=$(mktemp --tmpdir -u tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX) + BEFORE_LAST_PATH=$(mktemp --tmpdir -u tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX) $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT -a "$AFTER_FIRST_PATH" -b "$BEFORE_LAST_PATH" & CHILD_PID=$! @@ -55,7 +55,7 @@ function trace_ust_app function prepare_kernel_app { - WAIT_PATH=$(mktemp -u) + WAIT_PATH=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_wait_path.XXXXXX") "$TESTAPP_KERNEL_BIN" "$WAIT_PATH" $NR_ITER & CHILD_PID=$! @@ -78,7 +78,7 @@ function test_event_tracker() local tracker="$4" local channel='' - trace_path=$(mktemp -d) + trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX) create_lttng_session_ok $SESSION_NAME "$trace_path" @@ -117,7 +117,7 @@ function test_event_vpid_tracker() local wildcard="$3" local channel='' - trace_path=$(mktemp -d) + trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX) create_lttng_session_ok $SESSION_NAME "$trace_path" @@ -160,7 +160,7 @@ function test_event_pid_tracker() local wildcard="$3" local channel='' - trace_path=$(mktemp -d) + trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX) create_lttng_session_ok $SESSION_NAME "$trace_path" @@ -203,7 +203,7 @@ function test_event_tracker_fail() local wildcard="$2" local tracker="$3" - trace_path=$(mktemp -d) + trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX) create_lttng_session_ok $SESSION_NAME "$trace_path" enable_"$domain"_lttng_event_ok $SESSION_NAME "$wildcard" @@ -222,7 +222,7 @@ function test_event_track_untrack() local tracker="$4" local channel='' - trace_path=$(mktemp -d) + trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX) create_lttng_session_ok $SESSION_NAME "$trace_path" @@ -262,7 +262,7 @@ function test_event_vpid_track_untrack() local wildcard="$3" local channel='' - trace_path=$(mktemp -d) + trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX) create_lttng_session_ok $SESSION_NAME "$trace_path" @@ -302,7 +302,7 @@ function test_event_pid_track_untrack() local wildcard="$3" local channel='' - trace_path=$(mktemp -d) + trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX) create_lttng_session_ok $SESSION_NAME "$trace_path" @@ -336,9 +336,7 @@ function test_event_pid_track_untrack() function test_event_ust_vpid_untrack_snapshot() { - local trace_path - - trace_path=$(mktemp -d) + local trace_path=$(mktemp --tmpdir -d tmp.${FUNCNAME[0]}_trace_path.XXXXXX) diag "Test_event_ust_vpid_untrack_snapshot" diff --git a/tests/regression/tools/trigger/rate-policy/test_ust_rate_policy b/tests/regression/tools/trigger/rate-policy/test_ust_rate_policy index ef4626c25..91a571c13 100755 --- a/tests/regression/tools/trigger/rate-policy/test_ust_rate_policy +++ b/tests/regression/tools/trigger/rate-policy/test_ust_rate_policy @@ -28,7 +28,7 @@ function test_rate_policy_every_n() local END_TRIGGER_NAME="end-trigger1" local SYNC_AFTER_NOTIF_REGISTER_PATH - SYNC_AFTER_NOTIF_REGISTER_PATH=$(mktemp -u test-notif-register.XXXXXX) + SYNC_AFTER_NOTIF_REGISTER_PATH=$(mktemp --tmpdir -u test-notif-register.XXXXXX) diag "Every N rate policy" @@ -114,7 +114,7 @@ function test_rate_policy_once_after_n() local END_TRIGGER_NAME="end-trigger1" local SYNC_AFTER_NOTIF_REGISTER_PATH - SYNC_AFTER_NOTIF_REGISTER_PATH=$(mktemp -u test-notif-register.XXXXXX) + SYNC_AFTER_NOTIF_REGISTER_PATH=$(mktemp --tmpdir -u test-notif-register.XXXXXX) diag "Once after N rate policy" diff --git a/tests/regression/tools/trigger/start-stop/test_start_stop b/tests/regression/tools/trigger/start-stop/test_start_stop index 989079c4d..f302d17d6 100755 --- a/tests/regression/tools/trigger/start-stop/test_start_stop +++ b/tests/regression/tools/trigger/start-stop/test_start_stop @@ -42,8 +42,8 @@ function test_start_session_action() { local SESSION_NAME="my_triggered_session" local TRIGGER_NAME="trigger1" - local TRACE_PATH=$(mktemp -d test-start-action-trace.XXXXXX) - local SYNC_AFTER_NOTIF_REGISTER_PATH=$(mktemp -u test-notif-register.XXXXXX) + local TRACE_PATH=$(mktemp --tmpdir -d test-start-action-trace.XXXXXX) + local SYNC_AFTER_NOTIF_REGISTER_PATH=$(mktemp --tmpdir -u test-notif-register.XXXXXX) diag "Start session action" @@ -95,8 +95,8 @@ function test_stop_session_action() { local SESSION_NAME="my_triggered_session" local TRIGGER_NAME="trigger1" - local TRACE_PATH=$(mktemp -d test-stop-action-trace.XXXXXX) - local SYNC_AFTER_NOTIF_REGISTER_PATH=$(mktemp -u test-notif-register.XXXXXX) + local TRACE_PATH=$(mktemp --tmpdir -d test-stop-action-trace.XXXXXX) + local SYNC_AFTER_NOTIF_REGISTER_PATH=$(mktemp --tmpdir -u test-notif-register.XXXXXX) diag "Stop session action" create_lttng_session_ok $SESSION_NAME "$TRACE_PATH" diff --git a/tests/regression/tools/trigger/test_add_trigger_cli b/tests/regression/tools/trigger/test_add_trigger_cli index cf45b4e96..0b551d4d1 100755 --- a/tests/regression/tools/trigger/test_add_trigger_cli +++ b/tests/regression/tools/trigger/test_add_trigger_cli @@ -30,8 +30,8 @@ FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}" # shellcheck disable=SC2119 start_lttng_sessiond_notap -tmp_stdout=$(mktemp -t test_parse_cli_trigger_stdout.XXXXXX) -tmp_stderr=$(mktemp -t test_parse_cli_trigger_stderr.XXXXXX) +tmp_stdout=$(mktemp --tmpdir -t test_parse_cli_trigger_stdout.XXXXXX) +tmp_stderr=$(mktemp --tmpdir -t test_parse_cli_trigger_stderr.XXXXXX) uprobe_elf_binary="${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary" if [ "$(id -u)" == "0" ]; then diff --git a/tests/regression/tools/trigger/test_list_triggers_cli b/tests/regression/tools/trigger/test_list_triggers_cli index 7a6050fc8..26f2f9f46 100755 --- a/tests/regression/tools/trigger/test_list_triggers_cli +++ b/tests/regression/tools/trigger/test_list_triggers_cli @@ -27,9 +27,9 @@ NUM_TESTS=106 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}" -tmp_stdout=$(mktemp -t test_list_triggers_cli_stdout.XXXXXX) -tmp_stderr=$(mktemp -t test_list_triggers_cli_stderr.XXXXXX) -tmp_expected_stdout=$(mktemp -t test_list_triggers_cli_expected_stdout.XXXXXX) +tmp_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_stdout.XXXXXX) +tmp_stderr=$(mktemp --tmpdir -t test_list_triggers_cli_stderr.XXXXXX) +tmp_expected_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_expected_stdout.XXXXXX) uprobe_elf_binary=$(realpath "${TESTDIR}/utils/testapp/userspace-probe-elf-binary/.libs/userspace-probe-elf-binary") uprobe_sdt_binary=$(realpath "${TESTDIR}/utils/testapp/userspace-probe-sdt-binary/.libs/userspace-probe-sdt-binary") register_some_triggers_bin=$(realpath "${CURDIR}/utils/register-some-triggers") diff --git a/tests/regression/tools/trigger/test_remove_trigger_cli b/tests/regression/tools/trigger/test_remove_trigger_cli index 126355a09..e42d0743c 100755 --- a/tests/regression/tools/trigger/test_remove_trigger_cli +++ b/tests/regression/tools/trigger/test_remove_trigger_cli @@ -27,9 +27,9 @@ plan_tests 17 FULL_LTTNG_BIN="${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}" -tmp_stdout=$(mktemp -t test_list_triggers_cli_stdout.XXXXXX) -tmp_stderr=$(mktemp -t test_list_triggers_cli_stderr.XXXXXX) -tmp_expected_stdout=$(mktemp -t test_list_triggers_cli_expected_stdout.XXXXXX) +tmp_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_stdout.XXXXXX) +tmp_stderr=$(mktemp --tmpdir -t test_list_triggers_cli_stderr.XXXXXX) +tmp_expected_stdout=$(mktemp --tmpdir -t test_list_triggers_cli_expected_stdout.XXXXXX) uid=$(id --user) gid=$(id --group) diff --git a/tests/regression/tools/wildcard/test_event_wildcard b/tests/regression/tools/wildcard/test_event_wildcard index 36d56cd3e..f69baffc4 100755 --- a/tests/regression/tools/wildcard/test_event_wildcard +++ b/tests/regression/tools/wildcard/test_event_wildcard @@ -35,7 +35,7 @@ function run_kernel function test_event_wildcard() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") DOMAIN="$1" FIND="$2" WILDCARD="$3" @@ -69,7 +69,7 @@ function test_event_wildcard() function test_event_wildcard_fail() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") DOMAIN="$1" WILDCARD="$2" diff --git a/tests/regression/tools/working-directory/test_relayd_working_directory b/tests/regression/tools/working-directory/test_relayd_working_directory index 58f00496f..c7e784cca 100755 --- a/tests/regression/tools/working-directory/test_relayd_working_directory +++ b/tests/regression/tools/working-directory/test_relayd_working_directory @@ -22,11 +22,10 @@ print_test_banner "$TEST_DESC" function test_relayd() { local relayd_bin_path="$DIR/../src/bin/lttng-relayd/$RELAYD_BIN" - local working_dir + local working_dir=$(realpath "$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_working_dir.XXXXXX")") local pid local cwd - working_dir=$(realpath "$(mktemp -d)") diag "Test lttng-relayd normal mode change working directory" @@ -57,11 +56,9 @@ function test_relayd() function test_relayd_daemon() { - local working_dir local cwd local pid - - working_dir=$(realpath "$(mktemp -d)") + local working_dir=$(realpath "$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_working_dir.XXXXXX")") diag "Test lttng-relayd daemon mode change working directory" @@ -101,11 +98,9 @@ function test_relayd_daemon_no_working_dir() function test_relayd_background() { - local working_dir local cwd local pid - - working_dir=$(realpath "$(mktemp -d)") + local working_dir=$(realpath "$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_working_dir.XXXXXX")") diag "Test lttng-relayd background mode change working directory" @@ -158,18 +153,16 @@ function test_relayd_debug_permission() skip $is_user "Skipping permission debug output test; operation can't fail as root" 6 || { local output_pattern='Working directory \".*\" is not writable' - local working_dir local cwd local pid - - working_dir=$(realpath "$(mktemp -d)") + local working_dir=$(realpath "$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_working_dir.XXXXXX")") # Removing write access to working dir okx chmod -w "$working_dir" # Redirect the error output to a temporary file - ERROR_OUTPUT_DEST=$(mktemp) + ERROR_OUTPUT_DEST=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_error_output.XXXXXX") start_lttng_relayd_opt 1 "-b" "-v --working-dir $working_dir" pid=$(lttng_pgrep "$RELAYD_MATCH") @@ -192,15 +185,13 @@ function test_relayd_failure() { local output_pattern='Failed to change working directory to' local relayd_bin_path="$DIR/../src/bin/lttng-relayd/$RELAYD_BIN" + local working_dir=$(realpath "$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_working_dir.XXXXXX")") + local output_dest=$(mktemp --tmpdir "tmp.${FUNCNAME[0]}_working_dir.XXXXXX") - local working_dir local working_dir_imaginary - local output_dest local pid - working_dir=$(realpath "$(mktemp -d)") working_dir_imaginary="${working_dir}/imaginary_directory" - output_dest=$(mktemp) diag "Test lttng-relayd normal mode change non-existing directory" @@ -225,11 +216,9 @@ function test_relayd_failure() function test_relayd_env() { - local working_dir local cwd local pid - - working_dir=$(realpath "$(mktemp -d)") + local working_dir=$(realpath "$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_working_dir.XXXXXX")") diag "Test lttng-relayd change working directory from env. variable" @@ -250,13 +239,10 @@ function test_relayd_env() function test_relayd_cmdline_overwrite_env() { - local working_dir_env - local working_dir_cmdline local cwd local pid - - working_dir_env=$(realpath "$(mktemp -d)") - working_dir_cmdline=$(realpath "$(mktemp -d)") + local working_dir_env=$(realpath "$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_working_dir_even.XXXXXX")") + local working_dir_cmdline=$(realpath "$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_working_dir_cmdline.XXXXXX")") diag "Test lttng-relayd change working directory command line overwrite env variable" diff --git a/tests/regression/ust/before-after/test_before_after b/tests/regression/ust/before-after/test_before_after index adcbff68c..de07d31a4 100755 --- a/tests/regression/ust/before-after/test_before_after +++ b/tests/regression/ust/before-after/test_before_after @@ -47,8 +47,8 @@ function test_before_apps() function test_after_apps() { local out - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") create_lttng_session_ok $SESSION_NAME $TRACE_PATH enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME @@ -85,7 +85,7 @@ start_lttng_sessiond diag "Start tracing BEFORE application is started" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_before_after_ust_trace_path.XXXXXX) test_before_apps out=$? @@ -98,7 +98,7 @@ rm -rf $TRACE_PATH diag "Start tracing AFTER application is started" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_before_after_ust_trace_path.XXXXXX) test_after_apps out=$? diff --git a/tests/regression/ust/blocking/test_blocking b/tests/regression/ust/blocking/test_blocking index abd50d459..617d9a278 100755 --- a/tests/regression/ust/blocking/test_blocking +++ b/tests/regression/ust/blocking/test_blocking @@ -146,7 +146,7 @@ i=0 while [ "$i" -lt "$TEST_COUNT" ]; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_blocking_ust_trace_path.XXXXXX) # Execute test ${TESTS[$i]} diff --git a/tests/regression/ust/buffers-pid/test_buffers_pid b/tests/regression/ust/buffers-pid/test_buffers_pid index 59f218c85..48c09538e 100755 --- a/tests/regression/ust/buffers-pid/test_buffers_pid +++ b/tests/regression/ust/buffers-pid/test_buffers_pid @@ -64,8 +64,8 @@ test_after_multiple_apps() { test_before_multiple_apps() { local out local i - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") diag "Start multiple applications BEFORE tracing is started" @@ -137,8 +137,8 @@ test_after_app() { test_before_app() { local out - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") diag "Start application BEFORE tracing is started" @@ -236,7 +236,7 @@ i=0 start_lttng_sessiond while [ $i -lt $TEST_COUNT ]; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_buffers_pid_trace_path.XXXXXX) ${TESTS[$i]} rm -rf $TRACE_PATH let "i++" diff --git a/tests/regression/ust/clock-override/test_clock_override b/tests/regression/ust/clock-override/test_clock_override index be91df234..6be2d8dff 100755 --- a/tests/regression/ust/clock-override/test_clock_override +++ b/tests/regression/ust/clock-override/test_clock_override @@ -66,8 +66,8 @@ function extract_clock_metadata_token() function test_getcpu_override_metadata() { - local ctf_metadata_file=$(mktemp -p $TRACE_PATH ctf-metadata.XXXXXX) - local clock_metadata_file=$(mktemp -p $TRACE_PATH clock-metadata.XXXXXX) + local ctf_metadata_file=$(mktemp --tmpdir -p $TRACE_PATH ctf-metadata.XXXXXX) + local clock_metadata_file=$(mktemp --tmpdir -p $TRACE_PATH clock-metadata.XXXXXX) local result="" diag "Clock override plugin metadata test" @@ -174,7 +174,7 @@ i=0 while [ "$i" -lt "$TEST_COUNT" ]; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_clock_override_ust_trace_path.XXXXXX) # Execute test ${TESTS[$i]} diff --git a/tests/regression/ust/getcpu-override/test_getcpu_override b/tests/regression/ust/getcpu-override/test_getcpu_override index 030d22042..7553b685b 100755 --- a/tests/regression/ust/getcpu-override/test_getcpu_override +++ b/tests/regression/ust/getcpu-override/test_getcpu_override @@ -173,7 +173,7 @@ start_lttng_sessiond for fct_test in ${TESTS[@]}; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_getcpu_override_trace_path.XXXXXX) ${fct_test} if [ $? -ne 0 ]; then diff --git a/tests/regression/ust/high-throughput/test_high_throughput b/tests/regression/ust/high-throughput/test_high_throughput index a6dbdc758..1640e3994 100755 --- a/tests/regression/ust/high-throughput/test_high_throughput +++ b/tests/regression/ust/high-throughput/test_high_throughput @@ -20,7 +20,7 @@ if [ ! -x "$CURDIR/$BIN_NAME" ]; then BAIL_OUT "No UST nevents binary detected." fi -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_high_throughput_ust_trace_path.XXXXXX) # MUST set TESTDIR before calling those functions @@ -50,8 +50,8 @@ stop_lttng_sessiond # Validate test -TEMP_FILE=$(mktemp) -TEMP_FILE_2=$(mktemp) +TEMP_FILE=$(mktemp --tmpdir tmp.test_high_throughput_tmp_file1.XXXXXX) +TEMP_FILE_2=$(mktemp --tmpdir tmp.test_high_throughput_tmp_file2.XXXXXX) traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l) babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2 diff --git a/tests/regression/ust/java-jul/test_java_jul b/tests/regression/ust/java-jul/test_java_jul index efedcfcb2..f2244cb72 100755 --- a/tests/regression/ust/java-jul/test_java_jul +++ b/tests/regression/ust/java-jul/test_java_jul @@ -79,8 +79,8 @@ function enable_jul_filter_loglevel_only() function test_jul_before_start () { - local file_sync_after_first=$(mktemp -u) - local file_sync_before_last=$(mktemp -u) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") diag "Test JUL application BEFORE tracing starts" create_lttng_session_ok $SESSION_NAME $TRACE_PATH @@ -694,7 +694,7 @@ skip $withapp "JUL support is needed. Skipping all tests." $NUM_TESTS || for fct_test in ${tests[@]}; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_java_jul_trace_path.XXXXXX) ${fct_test} if [ $? -ne 0 ]; then diff --git a/tests/regression/ust/java-log4j/test_java_log4j b/tests/regression/ust/java-log4j/test_java_log4j index 8b045025b..fc16e02d0 100755 --- a/tests/regression/ust/java-log4j/test_java_log4j +++ b/tests/regression/ust/java-log4j/test_java_log4j @@ -80,8 +80,8 @@ 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) + local file_sync_after_first=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX") + local file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") diag "Test LOG4J application BEFORE tracing starts" create_lttng_session_ok $SESSION_NAME $TRACE_PATH @@ -693,7 +693,7 @@ skip $withapp "LOG4J support is needed. Skipping all tests." $NUM_TESTS || for fct_test in ${tests[@]}; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_java_log4j_trace_path.XXXXXX) ${fct_test} if [ $? -ne 0 ]; then diff --git a/tests/regression/ust/low-throughput/test_low_throughput b/tests/regression/ust/low-throughput/test_low_throughput index 16ef27347..66ed8950f 100755 --- a/tests/regression/ust/low-throughput/test_low_throughput +++ b/tests/regression/ust/low-throughput/test_low_throughput @@ -19,7 +19,7 @@ if [ ! -x "$CURDIR/$BIN_NAME" ]; then BAIL_OUT "No UST nevents binary detected." fi -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_low_throughput_ust_trace_path.XXXXXX) # MUST set TESTDIR before calling those functions diff --git a/tests/regression/ust/multi-lib/test_multi_lib b/tests/regression/ust/multi-lib/test_multi_lib index f1ed62450..23821ed0f 100755 --- a/tests/regression/ust/multi-lib/test_multi_lib +++ b/tests/regression/ust/multi-lib/test_multi_lib @@ -234,7 +234,7 @@ start_lttng_sessiond while [ "$i" -lt "$TEST_COUNT" ]; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_multi_lib_ust_trace_path.XXXXXX) create_lttng_session_ok $SESSION_NAME $TRACE_PATH diff --git a/tests/regression/ust/multi-session/test_multi_session b/tests/regression/ust/multi-session/test_multi_session index ba73b7d20..5a58515d5 100755 --- a/tests/regression/ust/multi-session/test_multi_session +++ b/tests/regression/ust/multi-session/test_multi_session @@ -64,7 +64,7 @@ print_test_banner "$TEST_DESC" start_lttng_sessiond -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_multi_session_ust.XXXXXX) test_multi_session out=$? diff --git a/tests/regression/ust/namespaces/test_ns_contexts b/tests/regression/ust/namespaces/test_ns_contexts index 062146970..be038eb28 100755 --- a/tests/regression/ust/namespaces/test_ns_contexts +++ b/tests/regression/ust/namespaces/test_ns_contexts @@ -35,7 +35,6 @@ function test_ns() local session_name="${ns}_ns" local chan_name="${ns}_ns" local context_name="${ns}_ns" - local trace_path local ns_inode @@ -45,12 +44,12 @@ function test_ns() return fi + trace_path=$(mktemp --tmpdir -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + # Get the current ns inode number ns_inode=$(stat -c '%i' -L "/proc/$$/ns/$ns") ok $? "Get current $ns namespace inode: $ns_inode" - trace_path=$(mktemp -d) - start_lttng_sessiond create_lttng_session_ok "$session_name" "$trace_path" diff --git a/tests/regression/ust/namespaces/test_ns_contexts_change b/tests/regression/ust/namespaces/test_ns_contexts_change index 6ce614aba..c0af15e95 100755 --- a/tests/regression/ust/namespaces/test_ns_contexts_change +++ b/tests/regression/ust/namespaces/test_ns_contexts_change @@ -46,9 +46,9 @@ function test_ns() ns_inode=$(stat -c '%i' -L "/proc/$$/ns/$ns") ok $? "Get current $ns namespace inode: $ns_inode" || ns_inode="invalid" - trace_path=$(mktemp -d) - file_sync_before_last=$(mktemp -u) - file_sync_after_unshare=$(mktemp -u) + trace_path=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") + file_sync_before_last=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX") + file_sync_after_unshare=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}_sync_after_unshare.XXXXXX") start_lttng_sessiond diff --git a/tests/regression/ust/nprocesses/test_nprocesses b/tests/regression/ust/nprocesses/test_nprocesses index b74f5e0d7..7673370ce 100755 --- a/tests/regression/ust/nprocesses/test_nprocesses +++ b/tests/regression/ust/nprocesses/test_nprocesses @@ -36,8 +36,8 @@ start_lttng_sessiond # Start tests. Each is an infinite tracing loop. -file_sync_after_first=$(mktemp -u) -file_sync_before_last=$(mktemp -u) +file_sync_after_first=$(mktemp --tmpdir -u tmp.test_nprocesses_sync_after_first.XXXXXX) +file_sync_before_last=$(mktemp --tmpdir -u tmp.test_nprocesses_sync_before_last.XXXXXX) diag "Starting $NUM_PROCESS test applications" for i in `seq 1 $NUM_PROCESS` @@ -58,7 +58,7 @@ done pass "All applications are registered to sessiond" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_nprocesses_trace_path.XXXXXX) create_lttng_session_ok $SESSION_NAME $TRACE_PATH diff --git a/tests/regression/ust/overlap/test_overlap b/tests/regression/ust/overlap/test_overlap index c399c688d..d10284e06 100755 --- a/tests/regression/ust/overlap/test_overlap +++ b/tests/regression/ust/overlap/test_overlap @@ -643,7 +643,7 @@ start_lttng_sessiond while [ "$i" -lt "$TEST_COUNT" ]; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_overlap.XXXXXX) create_lttng_session_ok $SESSION_NAME $TRACE_PATH diff --git a/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush b/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush index 848fc2f3e..f9f4f1c95 100755 --- a/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush +++ b/tests/regression/ust/periodical-metadata-flush/test_periodical_metadata_flush @@ -17,7 +17,7 @@ SESSION_NAME="periodical-flush" EVENT_NAME="tp:tptest" BIN_NAME="gen-nevents" NUM_TESTS=38 -APP_TMP_FILE=$(mktemp -u) +APP_TMP_FILE=$(mktemp --tmpdir -u tmp.test_periodical_metadata_flush_ust_app_tmp_file.XXXXXX) APPS_PID= source $TESTDIR/utils/utils.sh @@ -312,7 +312,7 @@ i=0 start_lttng_sessiond while [ $i -lt $TEST_COUNT ]; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_periodical_metadata_flush_ust_trace_path.XXXXXX) ${TESTS[$i]} rm -rf $TRACE_PATH let "i++" diff --git a/tests/regression/ust/python-logging/test_python_logging.in b/tests/regression/ust/python-logging/test_python_logging.in index 4d9cbe376..5de8dd72f 100755 --- a/tests/regression/ust/python-logging/test_python_logging.in +++ b/tests/regression/ust/python-logging/test_python_logging.in @@ -106,8 +106,8 @@ function enable_python_filter_loglevel_only() function test_python_before_start () { - local ready_file=$(mktemp -u) - local go_file=$(mktemp -u) + local ready_file=$(mktemp --tmpdir -u) + local go_file=$(mktemp --tmpdir -u) diag "Test Python application BEFORE tracing starts" create_lttng_session_ok $SESSION_NAME $TRACE_PATH @@ -688,7 +688,7 @@ function test_python_filter_loglevel() function test_python_trigger_notify_action { uid=$(id --user) - tmp_expected_stdout=$(mktemp -t test_list_triggers_python_cli_expected_stdout.XXXXXX) + tmp_expected_stdout=$(mktemp --tmpdir -t test_list_triggers_python_cli_expected_stdout.XXXXXX) diag "Test Python trigger with notify action" @@ -753,7 +753,7 @@ skip $skip_agent "Python agent test skipped." $NUM_TESTS || do for fct_test in ${tests[@]}; do - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d tmp.test_python_logging_trace_path.XXXXXX) diag "(Python $python_version)" ${fct_test} $python_version diff --git a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush index 38165904f..8ef4f0d8c 100755 --- a/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush +++ b/tests/regression/ust/rotation-destroy-flush/test_rotation_destroy_flush @@ -130,7 +130,7 @@ while [ "$i" -lt "$TEST_COUNT" ]; do trap signal_cleanup SIGTERM SIGINT - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_rotation_destroy_flush.XXXXXX) # Execute test ${TESTS[$i]} diff --git a/tests/regression/ust/test_event_basic b/tests/regression/ust/test_event_basic index fd4a632a5..dd0c77145 100755 --- a/tests/regression/ust/test_event_basic +++ b/tests/regression/ust/test_event_basic @@ -19,7 +19,7 @@ source $TESTDIR/utils/utils.sh function test_event_basic() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="ust_event_basic" SESSION_NAME2="ust_event_basic2" CHAN_NAME="mychan" diff --git a/tests/regression/ust/test_event_perf b/tests/regression/ust/test_event_perf index 19c7ac7a4..33aab2981 100755 --- a/tests/regression/ust/test_event_perf +++ b/tests/regression/ust/test_event_perf @@ -56,7 +56,7 @@ function add_context_ust_skip_ok() # Only test parsing of the enabling by raw ID function test_parsing_raw() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="ust_event_basic" CHAN_NAME="mychan" @@ -84,7 +84,7 @@ function test_parsing_raw() function test_event_basic() { - TRACE_PATH=$(mktemp -d) + TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX") SESSION_NAME="ust_event_basic" CHAN_NAME="mychan" diff --git a/tests/regression/ust/test_event_tracef b/tests/regression/ust/test_event_tracef index 9347fb623..ca14c73f5 100755 --- a/tests/regression/ust/test_event_tracef +++ b/tests/regression/ust/test_event_tracef @@ -47,7 +47,7 @@ print_test_banner "$TEST_DESC" start_lttng_sessiond -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d tmp.test_event_tracef_trace_path.XXXXXX) test_event_tracef out=$? if [ $out -ne 0 ]; then diff --git a/tests/stress/test_multi_sessions_per_uid_10app b/tests/stress/test_multi_sessions_per_uid_10app index 4aaf1d91a..26565464a 100755 --- a/tests/stress/test_multi_sessions_per_uid_10app +++ b/tests/stress/test_multi_sessions_per_uid_10app @@ -126,7 +126,7 @@ diag "Starting applications" ./$TESTDIR/stress/$LAUNCH_APP $NR_APP & APPS_PID="${APPS_PID} ${!}" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_multi_sess_per_uid_10app.XXXXXX) test_stress out=$? diff --git a/tests/stress/test_multi_sessions_per_uid_5app_streaming b/tests/stress/test_multi_sessions_per_uid_5app_streaming index a0f1898b6..db225db0e 100755 --- a/tests/stress/test_multi_sessions_per_uid_5app_streaming +++ b/tests/stress/test_multi_sessions_per_uid_5app_streaming @@ -150,7 +150,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_multi_sess_per_uid_5app_streaming.XXXXXX) start_relayd "-o $TRACE_PATH" start_sessiond diff --git a/tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd b/tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd index c9a4576b6..9cb664d5b 100755 --- a/tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd +++ b/tests/stress/test_multi_sessions_per_uid_5app_streaming_kill_relayd @@ -152,7 +152,7 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" -TRACE_PATH=$(mktemp -d) +TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_multi_sess_per_uid_5app_kill_relayd.XXXXXX) start_relayd "-o $TRACE_PATH" start_sessiond diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 530a10623..b2991207a 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -718,7 +718,7 @@ function stop_lttng_sessiond_opt() fi if [ -z "$pids" ]; then - if [ "$is_cleanup" -eq 1 ]; then + if [ "$is_cleanup" -eq 1 ]; then : elif [ "$withtap" -eq "1" ]; then fail "No session daemon to kill" @@ -2249,8 +2249,8 @@ function lttng_remove_trigger_ok() function list_triggers_matches_ok () { - local tmp_stdout=$(mktemp -t test_list_triggers_cli_stdout.XXXXXX) - local tmp_stderr=$(mktemp -t test_list_triggers_cli_stderr.XXXXXX) + local tmp_stdout=$(mktemp --tmpdir -t "tmp.${FUNCNAME[0]}_stdout.XXXXXX") + local tmp_stderr=$(mktemp --tmpdir -t "tmp.${FUNCNAME[0]}_stderr.XXXXXX") local test_name="$1" local expected_stdout_file="$2" -- 2.34.1