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"
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
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
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")
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
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"
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")
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
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
# 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
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"
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.
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"
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"
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"
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]}
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
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
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"
{
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
{
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
{
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
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
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")
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]}
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
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
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"
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"
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"
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"
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"
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"
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"
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"
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"
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
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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:"
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"
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"
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.
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"
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"
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"
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"
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"
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"
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"
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
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
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"
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"
# 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"
# 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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
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
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"
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
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"
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"
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
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"
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"
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"
# 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"
NR_ITER=-1
# Temp file output
-OUTPUT_DIR=$(mktemp -d)
+OUTPUT_DIR=$(mktemp -d --tmpdir tmp.test_crash_shm.XXXXXX)
LAST_APP_PID=
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 &
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
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
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
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"
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
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
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
}
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
# 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
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
{
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
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
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
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
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
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
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)
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)
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)
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)
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"
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)
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"
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
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"
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
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"
function test_per_pid ()
{
- local metadata
- local metadata_env
local metadata_path
local testapp_pid
local value
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"
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
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"
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"
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"
skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
fi
-rm -rf "$TMPDIR"
+rm -rf "$TEST_TMPDIR"
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
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"
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
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"
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
skip 0 "Root access is needed. Skipping all kernel notification tests." $NUM_TESTS
fi
-rm -rf "$TMPDIR"
+rm -f "$TESTAPP_STATE_PATH"
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
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"
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
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"
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
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
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
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=""
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
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
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"
{
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 \
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
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
skip 0 "Root access is needed. Skipping all kernel notification tests." $KERNEL_NUM_TESTS
fi
-rm -rf "$TMPDIR"
+rm -f "$TEST_TMPDIR"
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"
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"
stop_lttng_sessiond_notap
-rm -rf "$TMPDIR"
+rm -rf "$TEST_TMPDIR"
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"
stop_lttng_sessiond_notap
-rm -rf "$TMPDIR"
+rm -f "$TESTAPP_STATE_PATH"
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"
stop_lttng_sessiond_notap
-rm -rf "$TMPDIR"
+rm -f $TESTAPP_STATE_PATH
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"
stop_lttng_sessiond_notap
-rm -rf "$TMPDIR"
+rm -rf "$TESTAPP_STATE_PATH"
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
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
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
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
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"
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"
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
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
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
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
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
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"
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
SESSION_NAME=""
CHANNEL_NAME="snapchan"
-TRACE_PATH=$(mktemp -d)
+TRACE_PATH=$(mktemp --tmpdir -d tmp.test_snapshots_kernel_trace_path.XXXXXX)
NUM_TESTS=2061
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
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
# 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 &
NUM_TESTS=105
-TRACE_PATH=$(mktemp -d)
+TRACE_PATH=$(mktemp --tmpdir -d tmp.test_snapshots_ust_trace_path.XXXXXX)
source $TESTDIR/utils/utils.sh
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 &
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
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
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
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
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
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
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"
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"
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"
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=$!
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=$!
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"
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"
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"
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"
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"
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"
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"
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"
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"
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"
{
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"
{
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"
# 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
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")
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)
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"
function test_event_wildcard_fail()
{
- TRACE_PATH=$(mktemp -d)
+ TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
DOMAIN="$1"
WILDCARD="$2"
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"
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"
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"
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")
{
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"
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"
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"
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
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=$?
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=$?
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]}
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"
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"
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++"
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"
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]}
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
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
# 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
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
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
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
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
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
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
start_lttng_sessiond
-TRACE_PATH=$(mktemp -d)
+TRACE_PATH=$(mktemp --tmpdir -d tmp.test_multi_session_ust.XXXXXX)
test_multi_session
out=$?
local session_name="${ns}_ns"
local chan_name="${ns}_ns"
local context_name="${ns}_ns"
-
local trace_path
local ns_inode
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"
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
# 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`
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
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
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
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++"
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
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"
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
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]}
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"
# 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"
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"
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
./$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=$?
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
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
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"
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"