TEST_DESC="Streaming - Snapshot UST tracing"
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/../../..
+CURDIR=$(dirname "$0")/
+TESTDIR="$CURDIR/../../.."
EVENT_NAME="tp:tptest"
SESSION_NAME=""
CHANNEL_NAME="chan1"
-BIN_NAME="gen-nevents"
TESTAPP_PATH="$TESTDIR/utils/testapp"
TESTAPP_NAME="gen-ust-events"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
NR_ITER=-1
NR_USEC_WAIT=100
-APPS_PID=
+APP_PIDS=()
TRACE_PATH=$(mktemp -d -t tmp.test_snapshots_ust_streaming_trace_path.XXXXXX)
NUM_TESTS=85
-source $TESTDIR/utils/utils.sh
+# shellcheck source-path=SCRIPTDIR/../../../
+source "$TESTDIR/utils/utils.sh"
if [ ! -x "$TESTAPP_BIN" ]; then
BAIL_OUT "No UST events binary detected."
local sess_name=$1
local trace_path=$2
local name=$3
- local extra_opt=""
+ local options=()
+ local args=()
- if [ ! -z $name ]; then
- extra_opt="-n $name"
+ if [ -n "$sess_name" ] ; then
+ options+=(-s "$sess_name")
fi
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output -s $sess_name $extra_opt $trace_path >/dev/null 2>&1
+ if [ -n "$name" ]; then
+ options+=(-n "$name")
+ fi
+
+ # Checking for any other optional arguments that should be passed to the lttng command
+ args=("$@")
+ if [ -n "${args[*]:3}" ] ; then
+ options+=("${args[@]:3}")
+ fi
+
+ # The trace_path is a positional argument and must always come last if it is defined
+ if [ -n "$trace_path" ] ; then
+ options+=("$trace_path")
+ fi
+
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" snapshot add-output "${options[@]}" >/dev/null 2>&1
ok $? "Added snapshot output $trace_path"
}
# Start trace application and return once one event has been hit.
function start_test_app()
{
- local tmp_file=$(mktemp -u -t tmp.test_${FUNCNAME[0]}_tmp_file.XXXXXX)
+ local tmp_file
+ tmp_file=$(mktemp -u -t 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 &
+ $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event "$tmp_file" &
ret=$?
- APPS_PID="${APPS_PID} ${!}"
+ APP_PIDS+=(${!})
ok $ret "Start application to trace"
# Wait for the application file to appear indicating that at least one
sleep 0.5
done
diag "Removing test app temporary file $tmp_file"
- rm -f $tmp_file
+ rm -f "$tmp_file"
}
function stop_test_apps()
{
diag "Stopping $TESTAPP_NAME"
- for p in ${APPS_PID}; do
- kill ${p}
- wait ${p} 2>/dev/null
- done
- APPS_PID=
+ kill "${APP_PIDS[@]}"
+ wait "${APP_PIDS[@]}" 2>/dev/null
+ APP_PIDS=()
}
# Test a snapshot using a default name for the output destination.
function test_ust_default_name_with_del()
{
diag "Test UST snapshot streaming with default name with delete output"
- create_lttng_session_no_output $SESSION_NAME
- enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_lttng_mmap_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
start_test_app
- snapshot_add_output $SESSION_NAME "net://localhost"
- lttng_snapshot_record $SESSION_NAME
+ snapshot_add_output "$SESSION_NAME" "net://localhost"
+ lttng_snapshot_record "$SESSION_NAME"
# Validate test
validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "$SESSION_NAME" "snapshot-1" 0
- validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-1*
- if [ $? -ne 0 ]; then
+ if ! validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-1*" ; then
stop_test_apps
return $?
fi
- lttng_snapshot_del_output_ok $SESSION_NAME 1
- snapshot_add_output $SESSION_NAME "net://localhost"
- lttng_snapshot_record $SESSION_NAME
+ lttng_snapshot_del_output_ok "$SESSION_NAME" 1
+ snapshot_add_output "$SESSION_NAME" "net://localhost"
+ lttng_snapshot_record "$SESSION_NAME"
# Validate test with the next ID since a del output was done prior.
validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "$SESSION_NAME" "snapshot-2" 1
- validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-2*
- if [ $? -ne 0 ]; then
+ if ! validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-2*" ; then
stop_test_apps
return $?
fi
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
stop_test_apps
function test_ust_default_name()
{
diag "Test UST snapshot streaming with default name"
- create_lttng_session_no_output $SESSION_NAME
- enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_lttng_mmap_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
start_test_app
- snapshot_add_output $SESSION_NAME "net://localhost"
- lttng_snapshot_record $SESSION_NAME
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ snapshot_add_output "$SESSION_NAME" "net://localhost"
+ lttng_snapshot_record "$SESSION_NAME"
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
# Validate test
validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "$SESSION_NAME" "snapshot-1" 0
- validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-1*
+ validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-1*"
out=$?
stop_test_apps
function test_ust_default_name_custom_uri()
{
diag "Test UST snapshot streaming with default name with custom URL"
- create_lttng_session_no_output $SESSION_NAME
- enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_lttng_mmap_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
start_test_app
- snapshot_add_output $SESSION_NAME "-C tcp://localhost:5342 -D tcp://localhost:5343"
- lttng_snapshot_record $SESSION_NAME
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ snapshot_add_output "$SESSION_NAME" '' '' -C tcp://localhost:5342 -D tcp://localhost:5343
+ lttng_snapshot_record "$SESSION_NAME"
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
# Validate test
validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "$SESSION_NAME" "snapshot-1" 0
- validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-1*
+ validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-1*"
out=$?
stop_test_apps
local name="asnapshotname"
diag "Test UST snapshot streaming with custom name"
- create_lttng_session_no_output $SESSION_NAME
- enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_lttng_mmap_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
start_test_app
- snapshot_add_output $SESSION_NAME "net://localhost" $name
- lttng_snapshot_record $SESSION_NAME
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ snapshot_add_output "$SESSION_NAME" "net://localhost" $name
+ lttng_snapshot_record "$SESSION_NAME"
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
- if ls $TRACE_PATH/$HOSTNAME/$SESSION_NAME*/$name* &> /dev/null; then
+ if ls "$TRACE_PATH/$HOSTNAME/$SESSION_NAME"*/"$name"* &> /dev/null; then
ok 0 "Custom name snapshot exists"
# Validate test
validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "$SESSION_NAME" "$name" 0
- validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*/$name-*
+ validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$SESSION_NAME*/$name-*"
out=$?
else
fail "No custom name snapshot found"
function test_ust_n_snapshot()
{
diag "Test ust snapshot streaming multiple consecutive snapshot"
- create_lttng_session_no_output $SESSION_NAME
- enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- snapshot_add_output $SESSION_NAME "net://localhost"
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_lttng_mmap_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ snapshot_add_output "$SESSION_NAME" "net://localhost"
start_test_app
for i in {0..4};
do
- start_lttng_tracing_ok $SESSION_NAME
- lttng_snapshot_record $SESSION_NAME
- stop_lttng_tracing_ok $SESSION_NAME
- validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "$SESSION_NAME" "snapshot-1" $i
- validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-1*
- if [ $? -ne 0 ]; then
+ start_lttng_tracing_ok "$SESSION_NAME"
+ lttng_snapshot_record "$SESSION_NAME"
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ validate_trace_path_ust_uid_snapshot_network "$TRACE_PATH" "$SESSION_NAME" "snapshot-1" "$i"
+ if ! validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$SESSION_NAME*/snapshot-1*" ; then
return 1
fi
set -u
- rm -rf $TRACE_PATH/$HOSTNAME
+ rm -rf "${TRACE_PATH:?}/${HOSTNAME}"
set +u
done
- destroy_lttng_session_ok $SESSION_NAME
+ destroy_lttng_session_ok "$SESSION_NAME"
stop_test_apps
return 0
}
bail_out_if_no_babeltrace
-if [ "$(id -u)" == "0" ]; then
- isroot=1
-else
- isroot=0
-fi
-
start_lttng_relayd "-o $TRACE_PATH"
+# shellcheck disable=SC2119
start_lttng_sessiond
tests=( test_ust_default_name_with_del
test_ust_n_snapshot
)
-for fct_test in ${tests[@]};
+for fct_test in "${tests[@]}";
do
SESSION_NAME=$(randstring 16 0)
- ${fct_test}
- if [ $? -eq 0 ]; then
+ if ${fct_test} ; then
# Only delete if successful
- rm -rf $TRACE_PATH
+ rm -rf "$TRACE_PATH"
else
break
fi
done
+# shellcheck disable=SC2119
stop_lttng_sessiond
+# shellcheck disable=SC2119
stop_lttng_relayd
TEST_DESC="Snapshots - UST tracing"
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/../../..
+CURDIR=$(dirname "$0")/
+TESTDIR="$CURDIR/../../.."
EVENT_NAME="tp:tptest"
SESSION_NAME=""
CHANNEL_NAME="snapchan"
TESTAPP_PATH="$TESTDIR/utils/testapp"
TESTAPP_NAME="gen-ust-events"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
-APPS_PID=
+APPS_PID=()
NUM_TESTS=104
TRACE_PATH=$(mktemp -d -t tmp.test_snapshots_ust_trace_path.XXXXXX)
-source $TESTDIR/utils/utils.sh
+# shellcheck source-path=SCRIPTDIR/../../../
+source "$TESTDIR/utils/utils.sh"
if [ ! -x "$TESTAPP_BIN" ]; then
BAIL_OUT "No UST events binary detected"
fi
# Need the number of snapshot to do.
-if [ -z $1 ]; then
+if [ -z "$1" ]; then
BAIL_OUT "A number of snapshot is needed"
fi
NR_SNAPSHOT=$1
-NUM_TESTS=$(($NUM_TESTS + ($NR_SNAPSHOT * 3)))
+NUM_TESTS=$((NUM_TESTS + (NR_SNAPSHOT * 3)))
function start_test_app()
{
- local tmp_file=$(mktemp -u -t "tmp.${FUNCNAME[0]}_tmp_file.XXXXXX")
+ local tmp_file
+ tmp_file=$(mktemp -u -t "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 &
+ $TESTAPP_BIN -i "$NR_ITER" -w "$NR_USEC_WAIT" --sync-after-first-event "$tmp_file" &
ret=$?
- APPS_PID="${APPS_PID} ${!}"
+ APPS_PID+=(${!})
ok $ret "Start application to trace"
# Wait for the application file to appear indicating that at least one
sleep 0.5
done
diag "Removing test app temporary file $tmp_file"
- rm -f $tmp_file
+ rm -f "$tmp_file"
}
function wait_test_apps()
{
diag "Waiting for $TESTAPP_NAME"
- for p in ${APPS_PID}; do
- wait ${p} 2>/dev/null
- done
+ wait "${APPS_PID[@]}" 2>/dev/null
}
function stop_test_apps()
{
diag "Stopping $TESTAPP_NAME"
- for p in ${APPS_PID}; do
- kill ${p}
- wait ${p} 2>/dev/null
- done
- APPS_PID=
+ kill "${APPS_PID[@]}"
+ wait "${APPS_PID[@]}"
+ APPS_PID=()
}
function snapshot_add_output ()
local trace_path=$2
local name=$3
local max_size=$4
- local extra_opt=""
+ local extra_opt=()
- if [ ! -z $name ]; then
- extra_opt+=" -n $name "
+ if [ -n "$name" ]; then
+ extra_opt+=(-n "$name")
fi
- if [ ! -z $max_size ]; then
- extra_opt+=" -m $max_size "
+ if [ -n "$max_size" ]; then
+ extra_opt+=(-m "$max_size")
fi
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output \
- -s $sess_name $extra_opt $trace_path > /dev/null 2>&1
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" snapshot add-output \
+ -s "$sess_name" "${extra_opt[@]}" "$trace_path" > /dev/null 2>&1
- ok $? "Added snapshot output $trace_path ($extra_opt)"
+ ok $? "Added snapshot output $trace_path (${extra_opt[*]})"
}
function snapshot_del_output ()
local sess_name=$1
local name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot del-output \
- -s $sess_name $name > /dev/null 2>&1
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" snapshot del-output \
+ -s "$sess_name" "$name" > /dev/null 2>&1
ok $? "Deleted snapshot output named $name"
}
local subbuf_size=$3
local subbuf_count=$4
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name \
- $chan_name -u --output mmap --overwrite \
- --num-subbuf=$subbuf_count \
- --subbuf-size $subbuf_size > /dev/null 2>&1
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel -s "$sess_name" \
+ "$chan_name" -u --output mmap --overwrite \
+ --num-subbuf="$subbuf_count" \
+ --subbuf-size "$subbuf_size" > /dev/null 2>&1
ok $? "Enable channel $channel_name for session $sess_name with subbuf size $subbuf_size"
}
local sess_name=$1
local chan_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name \
- $chan_name -u --output mmap --discard \
- --subbuf-size $(getconf PAGE_SIZE) --num-subbuf 2 \
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel -s "$sess_name" \
+ "$chan_name" -u --output mmap --discard \
+ --subbuf-size "$(getconf PAGE_SIZE)" --num-subbuf 2 \
> /dev/null 2>&1
ok $? "Enable channel $channel_name for session $sess_name with small discard buffers"
local sess_name=$1
local chan_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name \
- $chan_name -u --output mmap --overwrite \
- --subbuf-size $(getconf PAGE_SIZE) --num-subbuf 2 \
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel -s "$sess_name" \
+ "$chan_name" -u --output mmap --overwrite \
+ --subbuf-size "$(getconf PAGE_SIZE)" --num-subbuf 2 \
> /dev/null 2>&1
ok $? "Enable channel $channel_name for session $sess_name with small discard buffers"
output_names=("randomname" "somesnapshot")
diag "Test UST snapshot output listing"
- create_lttng_session_no_output $SESSION_NAME
- enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_lttng_mmap_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
- snapshot_add_output $SESSION_NAME "file://$TRACE_PATH" ${output_names[0]}
+ snapshot_add_output "$SESSION_NAME" "file://$TRACE_PATH" "${output_names[0]}"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot list-output \
- -s $SESSION_NAME 2>&1 | grep ${output_names[0]} > /dev/null
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" snapshot list-output \
+ -s "$SESSION_NAME" 2>&1 | grep "${output_names[0]}" > /dev/null
ok $? "Snapshot named ${output_names[0]} present in list-output listing"
- snapshot_del_output $SESSION_NAME ${output_names[0]}
+ snapshot_del_output "$SESSION_NAME" "${output_names[0]}"
- snapshot_add_output $SESSION_NAME "file://$TRACE_PATH" ${output_names[1]}
+ snapshot_add_output "$SESSION_NAME" "file://$TRACE_PATH" "${output_names[1]}"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot list-output \
- -s $SESSION_NAME 2>&1 | grep ${output_names[1]} > /dev/null
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" snapshot list-output \
+ -s "$SESSION_NAME" 2>&1 | grep "${output_names[1]}" > /dev/null
ok $? "Snapshot named ${output_names[1]} present in list-output listing"
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
}
function test_ust_local_snapshot ()
NR_USEC_WAIT=100
diag "Test local UST snapshots"
- create_lttng_session_no_output $SESSION_NAME
- enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
- lttng_snapshot_add_output_ok $SESSION_NAME file://$TRACE_PATH
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_lttng_mmap_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
+ lttng_snapshot_add_output_ok "$SESSION_NAME" "file://$TRACE_PATH"
# Returns once the application has at least fired ONE tracepoint.
start_test_app
- lttng_snapshot_record $SESSION_NAME
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ lttng_snapshot_record "$SESSION_NAME"
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
# Validate test
validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" 0
- validate_trace $EVENT_NAME $TRACE_PATH/
- if [ $? -eq 0 ]; then
+ if validate_trace $EVENT_NAME "$TRACE_PATH/" ; then
# Only delete if successful
- rm -rf $TRACE_PATH
+ rm -rf "$TRACE_PATH"
fi
stop_test_apps
diag "Test local UST snapshots with small discard buffers"
taskset -c "$(get_any_available_cpu)" -p $$ 1>/dev/null 2>&1
- create_lttng_session_no_output $SESSION_NAME
- enable_mmap_small_discard_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
- lttng_snapshot_add_output_ok $SESSION_NAME file://$TRACE_PATH
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_mmap_small_discard_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
+ lttng_snapshot_add_output_ok "$SESSION_NAME" "file://$TRACE_PATH"
# Run test apps, wait for them to complete.
start_test_app
wait_test_apps
# Take first snapshot, remember first line.
- lttng_snapshot_record $SESSION_NAME
- FIRST_LINE="$(trace_first_line $TRACE_PATH/)"
+ lttng_snapshot_record "$SESSION_NAME"
+ FIRST_LINE="$(trace_first_line "$TRACE_PATH/")"
diag "First line (1st snapshot): $FIRST_LINE"
- rm -rf $TRACE_PATH/
+ rm -rf "${TRACE_PATH:?}/"
# Run test apps, wait for them to complete.
start_test_app
wait_test_apps
# Take second snapshot, remember first line.
- lttng_snapshot_record $SESSION_NAME
- FIRST_LINE_2="$(trace_first_line $TRACE_PATH/)"
+ lttng_snapshot_record "$SESSION_NAME"
+ FIRST_LINE_2="$(trace_first_line "$TRACE_PATH/")"
diag "First line (2nd snapshot): $FIRST_LINE_2"
- rm -rf $TRACE_PATH/
+ rm -rf "${TRACE_PATH:?}/"
if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
fail "First snapshot event do not match"
pass "First snapshot event match"
fi
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
- taskset -p $OLDCPUSET $$ 1>/dev/null 2>&1
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
+ taskset -p "$OLDCPUSET" $$ 1>/dev/null 2>&1
}
function test_ust_local_snapshot_small_overwrite_buffers ()
diag "Test local UST snapshots with small overwrite buffers"
taskset -p "$(get_any_available_cpu)" $$ 1>/dev/null 2>&1
- create_lttng_session_no_output $SESSION_NAME
- enable_mmap_small_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
- lttng_snapshot_add_output_ok $SESSION_NAME file://$TRACE_PATH
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_mmap_small_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
+ lttng_snapshot_add_output_ok "$SESSION_NAME" "file://$TRACE_PATH"
# Run test apps, wait for them to complete.
start_test_app
wait_test_apps
# Take first snapshot, remember first line.
- lttng_snapshot_record $SESSION_NAME
- FIRST_LINE="$(trace_first_line $TRACE_PATH/)"
+ lttng_snapshot_record "$SESSION_NAME"
+ FIRST_LINE="$(trace_first_line "$TRACE_PATH/")"
diag "First line (1st snapshot): $FIRST_LINE"
- rm -rf $TRACE_PATH/
+ rm -rf "${TRACE_PATH:?}/"
# Run test apps, wait for them to complete.
start_test_app
wait_test_apps
# Take second snapshot, remember first line.
- lttng_snapshot_record $SESSION_NAME
- FIRST_LINE_2="$(trace_first_line $TRACE_PATH/)"
+ lttng_snapshot_record "$SESSION_NAME"
+ FIRST_LINE_2="$(trace_first_line "$TRACE_PATH/")"
diag "First line (2nd snapshot): $FIRST_LINE_2"
- rm -rf $TRACE_PATH/
+ rm -rf "${TRACE_PATH:?}/"
if [ x"$FIRST_LINE" != x"$FIRST_LINE_2" ]; then
pass "First snapshot event do not match"
fail "First snapshot event match"
fi
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
- taskset -p $OLDCPUSET $$ 1>/dev/null 2>&1
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
+ taskset -p "$OLDCPUSET" $$ 1>/dev/null 2>&1
}
function test_ust_local_snapshot_max_size ()
LM_BIN="$LM_PATH/$LM_NAME/$LM_NAME"
diag "Test local UST snapshots with > 4kB metadata"
- create_lttng_session_no_output $SESSION_NAME
- enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $LM_EVENT $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
- lttng_snapshot_add_output_ok $SESSION_NAME file://$TRACE_PATH
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_lttng_mmap_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $LM_EVENT $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
+ lttng_snapshot_add_output_ok "$SESSION_NAME" "file://$TRACE_PATH"
$LM_BIN --iter 1 --wait 1
ok $? "Start application to trace"
- lttng_snapshot_record $SESSION_NAME
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ lttng_snapshot_record "$SESSION_NAME"
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
# Validate test
validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" 0
- validate_trace $LM_EVENT $TRACE_PATH/
- if [ $? -eq 0 ]; then
+ if validate_trace $LM_EVENT "$TRACE_PATH/" ; then
# Only delete if successful
- rm -rf $TRACE_PATH
+ rm -rf "${TRACE_PATH:?}/"
fi
}
sess_name=$1
channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name --output mmap --overwrite >/dev/null 2>&1
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel --buffers-uid -u "$channel_name" -s "$sess_name" --output mmap --overwrite >/dev/null 2>&1
ok $? "Enable channel $channel_name per UID for session $sess_name"
}
NR_ITER=-1
NR_USEC_WAIT=100
diag "Test per-uid local UST snapshots"
- create_lttng_session_no_output $SESSION_NAME
- enable_channel_per_uid_mmap_overwrite $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
- lttng_snapshot_add_output_ok $SESSION_NAME file://$TRACE_PATH
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_channel_per_uid_mmap_overwrite "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
+ lttng_snapshot_add_output_ok "$SESSION_NAME" "file://$TRACE_PATH"
# Returns once the application has at least fired ONE tracepoint.
start_test_app
- lttng_snapshot_record $SESSION_NAME
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ lttng_snapshot_record "$SESSION_NAME"
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
# Validate test
validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" 0
- validate_trace $EVENT_NAME $TRACE_PATH/
- if [ $? -eq 0 ]; then
+ if validate_trace $EVENT_NAME "$TRACE_PATH/" ; then
# Only delete if successful
- rm -rf $TRACE_PATH
+ rm -rf "${TRACE_PATH:?}/"
fi
stop_test_apps
NR_USEC_WAIT=100
diag "Test local UST snapshots post-mortem"
- create_lttng_session_no_output $SESSION_NAME
- enable_channel_per_uid_mmap_overwrite $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
- lttng_snapshot_add_output_ok $SESSION_NAME file://$TRACE_PATH
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_channel_per_uid_mmap_overwrite "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
+ lttng_snapshot_add_output_ok "$SESSION_NAME" "file://$TRACE_PATH"
# Returns once the application has at least fired ONE tracepoint.
start_test_app
stop_test_apps
- lttng_snapshot_record $SESSION_NAME
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ lttng_snapshot_record "$SESSION_NAME"
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
# Validate test
validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" 0
- validate_trace $EVENT_NAME $TRACE_PATH/
- if [ $? -eq 0 ]; then
+ if validate_trace $EVENT_NAME "$TRACE_PATH/" ; then
# Only delete if successful
- rm -rf $TRACE_PATH
+ rm -rf "${TRACE_PATH:?}/"
fi
}
NR_USEC_WAIT=100
diag "Test $NR_SNAPSHOT local UST snapshots"
- create_lttng_session_no_output $SESSION_NAME
- enable_lttng_mmap_overwrite_ust_channel $SESSION_NAME $CHANNEL_NAME
- enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHANNEL_NAME
- start_lttng_tracing_ok $SESSION_NAME
- lttng_snapshot_add_output_ok $SESSION_NAME file://$TRACE_PATH
+ create_lttng_session_no_output "$SESSION_NAME"
+ enable_lttng_mmap_overwrite_ust_channel "$SESSION_NAME" $CHANNEL_NAME
+ enable_ust_lttng_event_ok "$SESSION_NAME" $EVENT_NAME $CHANNEL_NAME
+ start_lttng_tracing_ok "$SESSION_NAME"
+ lttng_snapshot_add_output_ok "$SESSION_NAME" "file://$TRACE_PATH"
# Returns once the application has at least fired ONE tracepoint.
start_test_app
- for i in $(seq 1 $NR_SNAPSHOT); do
+ for i in $(seq 1 "$NR_SNAPSHOT"); do
diag "Snapshot $i/$NR_SNAPSHOT"
- rm -rf $TRACE_PATH/snapshot/* 2>/dev/null
- lttng_snapshot_record $SESSION_NAME
+ rm -rf "$TRACE_PATH/snapshot/*" 2>/dev/null
+ lttng_snapshot_record "$SESSION_NAME"
# Validate test
validate_trace_path_ust_uid_snapshot "$TRACE_PATH" "" "snapshot-1" $((i - 1))
- validate_trace $EVENT_NAME $TRACE_PATH/
- if [ $? -eq 0 ]; then
+ if validate_trace $EVENT_NAME "$TRACE_PATH/" ; then
# Only delete if successful
- rm -rf $TRACE_PATH
+ rm -rf "${TRACE_PATH:?}/"
fi
done
- stop_lttng_tracing_ok $SESSION_NAME
- destroy_lttng_session_ok $SESSION_NAME
+ stop_lttng_tracing_ok "$SESSION_NAME"
+ destroy_lttng_session_ok "$SESSION_NAME"
stop_test_apps
}
bail_out_if_no_babeltrace
+# shellcheck disable=SC2119
start_lttng_sessiond
tests=( test_ust_list_output
test_ust_local_snapshot
test_ust_local_snapshot_small_overwrite_buffers
)
-for fct_test in ${tests[@]};
+for fct_test in "${tests[@]}";
do
SESSION_NAME=$(randstring 16 0)
${fct_test}
done
+# shellcheck disable=SC2119
stop_lttng_sessiond
NUM_PROCESS=30
TEST_DESC="UST tracer - Generate $NUM_PROCESS process"
-CURDIR=$(dirname $0)/
+CURDIR=$(dirname "$0")/
TESTDIR=$CURDIR/../../..
-NR_ITER=-1 # infinite loop
+NR_ITER=-1 # infinite loop
NR_USEC_WAIT=1000000
TESTAPP_PATH="$TESTDIR/utils/testapp"
TESTAPP_NAME="gen-ust-events"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
SESSION_NAME="ust-nprocesses"
EVENT_NAME="tp:tptest"
-TEST_WAIT_SEC=5
NUM_TESTS=9
-APPS_PID=
+APP_PIDS=()
-source $TESTDIR/utils/utils.sh
+# shellcheck source-path=SCRIPTDIR/../../../
+source "${TESTDIR}/utils/utils.sh"
if [ ! -x "$TESTAPP_BIN" ]; then
BAIL_OUT "No UST $TESTAPP_BIN binary detected."
print_test_banner "$TEST_DESC"
+# shellcheck disable=SC2119
start_lttng_sessiond
# Start tests. Each is an infinite tracing loop.
file_sync_before_last=$(mktemp -u -t tmp.test_nprocesses_sync_before_last.XXXXXX)
diag "Starting $NUM_PROCESS test applications"
-for i in `seq 1 $NUM_PROCESS`
+# shellcheck disable=SC2034
+for i in $(seq 1 $NUM_PROCESS)
do
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
- --sync-after-first-event ${file_sync_after_first} \
- --sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 &
- APPS_PID="${APPS_PID} ${!}"
+ --sync-after-first-event "${file_sync_after_first}" \
+ --sync-before-last-event "${file_sync_before_last}" >/dev/null 2>&1 &
+ APP_PIDS+=(${!})
done
diag "Waiting for applications to be registered to sessiond"
reg_app_count=0
while [ $reg_app_count -ne $NUM_PROCESS ]; do
- listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u)
- reg_app_count=$(echo -n $listing | sed "s#$TESTAPP_BIN#$TESTAPP_BIN\n#g" | grep "$TESTAPP_BIN" | wc -l)
+ listing=$("${TESTDIR}/../src/bin/lttng/${LTTNG_BIN}" list -u)
+ reg_app_count=$(echo -n "${listing}" | sed "s#$TESTAPP_BIN#$TESTAPP_BIN\n#g" | grep -c "$TESTAPP_BIN")
done
pass "All applications are registered to sessiond"
TRACE_PATH=$(mktemp -d -t tmp.test_nprocesses_trace_path.XXXXXX)
-create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+create_lttng_session_ok $SESSION_NAME "${TRACE_PATH}"
enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
-touch ${file_sync_before_last}
+touch "${file_sync_before_last}"
# We don't validate whether the applications have traced here, rather
# just that they registered to sessiond (above).
#TODO: add trace validation.
-rm -rf $TRACE_PATH
+rm -rf "${TRACE_PATH}"
diag "Stopping all spawned applications"
-for p in ${APPS_PID}; do
- kill ${p}
- wait ${p} 2>/dev/null
-done
-APPS_PID=
+kill "${APP_PIDS[@]}"
+wait "${APP_PIDS[@]}" 2>/dev/null
+APP_PIDS=()
pass "Stopped all spawned applications"
-rm -f ${file_sync_after_first}
-rm -f ${file_sync_before_last}
+rm -f "${file_sync_after_first}"
+rm -f "${file_sync_before_last}"
+# shellcheck disable=SC2119
stop_lttng_sessiond
TEST_DESC="UST tracer - Tracing with per UID buffers and periodical flush"
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/../../..
+CURDIR=$(dirname "$0")/
+TESTDIR="$CURDIR/../../.."
NR_ITER=100
NR_USEC_WAIT=100000
TESTAPP_PATH="$TESTDIR/utils/testapp"
TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
SESSION_NAME="periodical-flush"
EVENT_NAME="tp:tptest"
-BIN_NAME="gen-nevents"
NUM_TESTS=38
APP_TMP_FILE=$(mktemp -u -t tmp.test_periodical_metadata_flush_ust_app_tmp_file.XXXXXX)
-APPS_PID=
+APP_PIDS=()
-source $TESTDIR/utils/utils.sh
+# shellcheck source-path=SCRIPTDIR/../../../
+source "$TESTDIR/utils/utils.sh"
if [ ! -x "$TESTAPP_BIN" ]; then
BAIL_OUT "No UST events binary detected."
local sess_name=$1
local channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name --switch-timer 100000 >/dev/null 2>&1
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel --buffers-uid -u "$channel_name" -s "$sess_name" --switch-timer 100000 >/dev/null 2>&1
ok $? "Enable channel $channel_name per UID for session $sess_name"
}
local sess_name=$1
local channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-pid -u $channel_name -s $sess_name --switch-timer 100000 >/dev/null 2>&1
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel --buffers-pid -u "$channel_name" -s "$sess_name" --switch-timer 100000 >/dev/null 2>&1
ok $? "Enable channel $channel_name per UID for session $sess_name"
}
local sess_name=$1
local channel_name="metadata"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name --switch-timer 200000 >/dev/null 2>&1
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel --buffers-uid -u "$channel_name" -s "$sess_name" --switch-timer 200000 2>&1
ok $? "Enable channel $channel_name per UID for session $sess_name"
}
local sess_name=$1
local channel_name="metadata"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-pid -u $channel_name -s $sess_name --switch-timer 200000 >/dev/null 2>&1
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel --buffers-pid -u "$channel_name" -s "$sess_name" --switch-timer 200000 >/dev/null 2>&1
ok $? "Enable channel $channel_name per PID for session $sess_name"
}
{
local out
- out=$("$BABELTRACE_BIN" $TRACE_PATH | grep $EVENT_NAME | wc -l)
- if [ $out -eq 0 ]; then
+ out=$("$BABELTRACE_BIN" "$TRACE_PATH" | grep -c $EVENT_NAME)
+ if [ "$out" -eq 0 ]; then
fail "Trace validation"
diag "No event(s) found. We are supposed to have at least one."
out=1
sleep 0.5
done
diag "Removing test app temporary file $APP_TMP_FILE"
- rm -f $APP_TMP_FILE
+ rm -f "$APP_TMP_FILE"
}
function start_trace_app()
{
# Start application with a temporary file.
- $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event $APP_TMP_FILE &
+ $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event "$APP_TMP_FILE" &
ret=$?
- APPS_PID="${APPS_PID} ${!}"
+ APP_PIDS+=(${!})
ok $ret "Start application to trace"
}
function wait_trace_apps()
{
- for p in ${APPS_PID}; do
- wait ${p} 2>/dev/null
- done
- APPS_PID=
+ wait "${APP_PIDS[@]}" 2> /dev/null
+ APP_PIDS=()
}
test_after_app_pid() {
local out
- APPS_PID=
+ APP_PIDS=()
diag "Start application AFTER tracing is started"
- create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+ create_lttng_session_ok $SESSION_NAME "$TRACE_PATH"
enable_metadata_per_pid $SESSION_NAME
enable_channel_per_pid $SESSION_NAME "channel0"
enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0"
# Make sure the application does not generate any more data,
# thus ensuring that we are not flushing a packet concurrently
# with validate_trace.
- for p in ${APPS_PID}; do
- kill -s SIGSTOP ${p}
- done
+ kill -s SIGSTOP "${APP_PIDS[@]}"
# Give time to the consumer to write inflight data.
sleep 2
+ # shellcheck disable=SC2119
validate_trace
out=$?
- for p in ${APPS_PID}; do
- kill -s SIGKILL ${p}
- wait ${p} 2>/dev/null
- done
+ kill -s SIGKILL "${APP_PIDS[@]}"
+ wait "${APP_PIDS[@]}" 2>/dev/null
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
test_before_app_pid() {
local out
- local tmp_file="/tmp/lttng_test_ust.42.file"
- APPS_PID=
+ APP_PIDS=()
diag "Start application BEFORE tracing is started"
start_trace_app
# Start application before tracing
- create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+ create_lttng_session_ok $SESSION_NAME "$TRACE_PATH"
enable_metadata_per_pid $SESSION_NAME
enable_channel_per_pid $SESSION_NAME "channel0"
enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0"
# Make sure the application does not generate any more data,
# thus ensuring that we are not flushing a packet concurrently
# with validate_trace.
- for p in ${APPS_PID}; do
- kill -s SIGSTOP ${p}
- done
+ kill -s SIGSTOP "${APP_PIDS[@]}"
# Give time to the consumer to write inflight data.
sleep 2
+ # shellcheck disable=SC2119
validate_trace
out=$?
- for p in ${APPS_PID}; do
- kill -s SIGKILL ${p}
- wait ${p} 2>/dev/null
- done
+ kill -s SIGKILL "${APP_PIDS[@]}"
+ wait "${APP_PIDS[@]}" 2>/dev/null
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
test_after_app_uid() {
local out
- APPS_PID=
+ APP_PIDS=()
diag "Start application AFTER tracing is started"
- create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+ create_lttng_session_ok $SESSION_NAME "$TRACE_PATH"
enable_metadata_per_uid $SESSION_NAME
enable_channel_per_uid $SESSION_NAME "channel0"
enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0"
# Make sure the application does not generate any more data,
# thus ensuring that we are not flushing a packet concurrently
# with validate_trace.
- for p in ${APPS_PID}; do
- kill -s SIGSTOP ${p}
- done
-
+ kill -s SIGSTOP "${APP_PIDS[@]}"
# Give time to the consumer to write inflight data.
sleep 2
+ # shellcheck disable=SC2119
validate_trace
out=$?
- for p in ${APPS_PID}; do
- kill -s SIGKILL ${p}
- wait ${p} 2>/dev/null
- done
+ kill -s SIGKILL "${APP_PIDS[@]}"
+ wait "${APP_PIDS[@]}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
test_before_app_uid() {
local out
- APPS_PID=
+ APP_PIDS=()
diag "Start application BEFORE tracing is started"
# Start application before tracing
start_trace_app
- create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+ create_lttng_session_ok $SESSION_NAME "$TRACE_PATH"
enable_metadata_per_uid $SESSION_NAME
enable_channel_per_uid $SESSION_NAME "channel0"
enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0"
# Make sure the application does not generate any more data,
# thus ensuring that we are not flushing a packet concurrently
# with validate_trace.
- for p in ${APPS_PID}; do
- kill -s SIGSTOP ${p}
- done
+ kill -s SIGSTOP "${APP_PIDS[@]}"
# Give time to the consumer to write inflight data.
sleep 2
+ # shellcheck disable=SC2119
validate_trace
out=$?
- for p in ${APPS_PID}; do
- kill -s SIGKILL ${p}
- wait ${p} 2>/dev/null
- done
+ kill -s SIGKILL "${APP_PIDS[@]}"
+ wait "${APP_PIDS[@]}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
TEST_COUNT=${#TESTS[@]}
i=0
+# shellcheck disable=SC2119
start_lttng_sessiond
-while [ $i -lt $TEST_COUNT ]; do
+while [ $i -lt "$TEST_COUNT" ]; do
TRACE_PATH=$(mktemp -d -t tmp.test_periodical_metadata_flush_ust_trace_path.XXXXXX)
${TESTS[$i]}
- rm -rf $TRACE_PATH
- let "i++"
+ rm -rf "$TRACE_PATH"
+ (( "i++" ))
done
+# shellcheck disable=SC2119
stop_lttng_sessiond
# SPDX-License-Identifier: LGPL-2.1-only
#
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/..
+CURDIR=$(dirname "$0")/
+TESTDIR="$CURDIR/.."
LAUNCH_APP="launch_ust_app"
SESSION_NAME="stress"
EVENT_NAME="tp:tptest"
NR_SESSION=5
NR_LOOP=1000
COREDUMP_FILE=$(cat /proc/sys/kernel/core_pattern)
-APPS_PID=
+APP_PIDS=()
TEST_DESC="Stress test - $NR_SESSION sessions per UID with $NR_APP apps"
-source $TESTDIR/utils/utils.sh
+# shellcheck source-path=SCRIPTDIR/../
+source "$TESTDIR/utils/utils.sh"
# MUST set TESTDIR before calling those functions
function enable_channel_per_uid()
{
- local sess_name=$1
- local channel_name=$2
+ local sess_name=$1
+ local channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name >/dev/null 2>&1
- ok $? "Enable channel $channel_name per UID for session $sess_name"
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel --buffers-uid -u "$channel_name" -s "$sess_name" >/dev/null 2>&1
+ ok $? "Enable channel $channel_name per UID for session $sess_name"
}
function check_sessiond()
{
- if [ -z "$(lttng_pgrep lt-lttng-sessiond)" ]; then
- local str_date=$(date +%H%M%S-%d%m%Y)
+ local str_date=''
+ if [ -z "$(lttng_pgrep lttng-sessiond)" ]; then
+ str_date=$(date +%H%M%S-%d%m%Y)
diag "!!!The session daemon died unexpectedly!!!"
- mv $LOG_FILE $LOG_FILE-$str_date
- if [ -e $COREDUMP_FILE ]; then
- mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
+ mv $LOG_FILE "$LOG_FILE-$str_date"
+ if [ -e "$COREDUMP_FILE" ]; then
+ mv "$COREDUMP_FILE" "$COREDUMP_FILE-$str_date"
fi
exit 1
fi
function start_sessiond()
{
- validate_kernel_version
- if [ $? -ne 0 ]; then
+ if ! validate_kernel_version ; then
fail "Start session daemon"
BAIL_OUT "*** Kernel too old for session daemon tests ***"
fi
- if [ -z $(lttng_pgrep lt-$SESSIOND_BIN) ]; then
+ if [ -z "$(lttng_pgrep $SESSIOND_BIN)" ]; then
# We have to start it like this so the ulimit -c is used by this
# process. Also, we collect any error message printed out.
- $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --quiet --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE 2>&1
+ "$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN" --quiet --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE 2>&1
status=$?
ok $status "Start session daemon"
fi
test_stress()
{
+ # shellcheck disable=SC2034
for b in $(seq 1 $NR_LOOP); do
for a in $(seq 1 $NR_SESSION); do
- create_lttng_session_ok $SESSION_NAME-$a $TRACE_PATH
+ create_lttng_session_ok $SESSION_NAME-"$a" "$TRACE_PATH"
check_sessiond
- enable_channel_per_uid $SESSION_NAME-$a $CHANNEL_NAME
+ enable_channel_per_uid $SESSION_NAME-"$a" $CHANNEL_NAME
check_sessiond
- enable_ust_lttng_event_ok $SESSION_NAME-$a $EVENT_NAME
+ enable_ust_lttng_event_ok $SESSION_NAME-"$a" $EVENT_NAME
check_sessiond
- start_lttng_tracing_ok $SESSION_NAME-$a
+ start_lttng_tracing_ok $SESSION_NAME-"$a"
check_sessiond
done
for a in $(seq 1 $NR_SESSION); do
- stop_lttng_tracing_ok $SESSION_NAME-$a
+ stop_lttng_tracing_ok $SESSION_NAME-"$a"
check_sessiond
- destroy_lttng_session_ok $SESSION_NAME-$a
+ destroy_lttng_session_ok $SESSION_NAME-"$a"
check_sessiond
done
done
function cleanup()
{
diag "Cleaning up!"
- for p in ${APPS_PID}; do
- kill -s SIGKILL ${p}
- wait ${p} 2>/dev/null
- done
- APPS_PID=
+ kill -s SIGKILL "${APP_PIDS[@]}"
+ wait "${APP_PIDS[@]}" 2>/dev/null
+ APP_PIDS=()
+ # shellcheck disable=SC2119
stop_lttng_sessiond
}
function sighandler()
{
cleanup
- rm $LOG_FILE
+ rm "$LOG_FILE"
full_cleanup
}
diag "Starting applications"
# Start NR_APP applications script that will spawn apps non stop.
-./$TESTDIR/stress/$LAUNCH_APP $NR_APP &
-APPS_PID="${APPS_PID} ${!}"
+"./$TESTDIR/stress/$LAUNCH_APP" $NR_APP &
+APP_PIDS+=(${!})
TRACE_PATH=$(mktemp -d -t tmp.test_multi_sess_per_uid_10app.XXXXXX)
fi
cleanup
-rm -rf $TRACE_PATH
+rm -rf "${TRACE_PATH:?}/"
rm $LOG_FILE
exit 0
# SPDX-License-Identifier: LGPL-2.1-only
#
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/..
+CURDIR=$(dirname "$0")/
+TESTDIR="$CURDIR/.."
LAUNCH_APP="launch_ust_app"
SESSION_NAME="stress"
EVENT_NAME="tp:tptest"
NR_LOOP=1000
COREDUMP_FILE=$(cat /proc/sys/kernel/core_pattern)
NUM_TESTS=16
-APPS_PID=
+APP_PIDS=()
TEST_DESC="Stress test - $NR_SESSION sessions per UID streaming with $NR_APP apps"
-source $TESTDIR/utils/utils.sh
+# shellcheck source-path=SCRIPTDIR/../
+source "$TESTDIR/utils/utils.sh"
# MUST set TESTDIR before calling those functions
function enable_channel_per_uid()
{
- local sess_name=$1
- local channel_name=$2
+ local sess_name=$1
+ local channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name >/dev/null 2>&1
- ok $? "Enable channel $channel_name per UID for session $sess_name"
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel --buffers-uid -u "$channel_name" -s "$sess_name" >/dev/null 2>&1
+ ok $? "Enable channel $channel_name per UID for session $sess_name"
}
function check_sessiond()
{
- if [ -z "$(lttng_pgrep lt-lttng-sessiond)" ]; then
- local str_date=$(date +%H%M%S-%d%m%Y)
+ local str_date
+ if [ -z "$(lttng_pgrep lttng-sessiond)" ]; then
+ str_date=$(date +%H%M%S-%d%m%Y)
diag "!!!The session daemon died unexpectedly!!!"
- mv $LOG_FILE_SESSIOND $LOG_FILE_SESSIOND-$str_date
- if [ -e $COREDUMP_FILE ]; then
- mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
+ mv $LOG_FILE_SESSIOND "$LOG_FILE_SESSIOND-$str_date"
+ if [ -e "$COREDUMP_FILE" ]; then
+ mv "$COREDUMP_FILE" "$COREDUMP_FILE-$str_date"
fi
exit 1
fi
function check_relayd()
{
- if [ -z "$(lttng_pgrep lt-lttng-relayd)" ]; then
- local str_date=$(date +%H%M%S-%d%m%Y)
+ local str_date
+ if [ -z "$(lttng_pgrep lttng-relayd)" ]; then
+ str_date=$(date +%H%M%S-%d%m%Y)
diag "!!!The relay daemon died unexpectedly!!!"
- mv $LOG_FILE_RELAYD $LOG_FILE_RELAYD-$str_date
- if [ -e $COREDUMP_FILE ]; then
- mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
+ mv $LOG_FILE_RELAYD "$LOG_FILE_RELAYD-$str_date"
+ if [ -e "$COREDUMP_FILE" ]; then
+ mv "$COREDUMP_FILE" "$COREDUMP_FILE-$str_date"
fi
exit 1
fi
function start_sessiond()
{
- validate_kernel_version
- if [ $? -ne 0 ]; then
+ if ! validate_kernel_version ; then
fail "Start session daemon"
BAIL_OUT "*** Kernel too old for session daemon tests ***"
fi
- if [ -z $(lttng_pgrep lt-$SESSIOND_BIN) ]; then
+ if [ -z "$(lttng_pgrep lt-$SESSIOND_BIN)" ]; then
# We have to start it like this so the ulimit -c is used by this
# process. Also, we collect any error message printed out.
- $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --quiet --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
+ "$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN" --quiet --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
status=$?
ok $status "Start session daemon"
fi
{
local opt=$1
- if [ -z $(lttng_pgrep lt-$RELAYD_BIN) ]; then
- $TESTDIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >$LOG_FILE_RELAYD 2>&1 &
+ if [ -z "$(lttng_pgrep lt-$RELAYD_BIN)" ]; then
+ "$TESTDIR/../src/bin/lttng-relayd/$RELAYD_BIN" "$opt" >"$LOG_FILE_RELAYD" 2>&1 &
ok $? "Start lttng-relayd (opt: \"$opt\")"
fi
}
test_stress()
{
+ # shellcheck disable=SC2034
for b in $(seq 1 $NR_LOOP); do
for a in $(seq 1 $NR_SESSION); do
- create_lttng_session_uri $SESSION_NAME-$a net://localhost
+ create_lttng_session_uri $SESSION_NAME-"$a" net://localhost
check_sessiond
check_relayd
- enable_channel_per_uid $SESSION_NAME-$a $CHANNEL_NAME
+ enable_channel_per_uid $SESSION_NAME-"$a" $CHANNEL_NAME
check_sessiond
check_relayd
- enable_ust_lttng_event_ok $SESSION_NAME-$a $EVENT_NAME
+ enable_ust_lttng_event_ok $SESSION_NAME-"$a" $EVENT_NAME
check_sessiond
check_relayd
- start_lttng_tracing_ok $SESSION_NAME-$a
+ start_lttng_tracing_ok $SESSION_NAME-"$a"
check_sessiond
check_relayd
done
for a in $(seq 1 $NR_SESSION); do
- stop_lttng_tracing_ok $SESSION_NAME-$a
+ stop_lttng_tracing_ok $SESSION_NAME-"$a"
check_sessiond
check_relayd
- destroy_lttng_session_ok $SESSION_NAME-$a
+ destroy_lttng_session_ok $SESSION_NAME-"$a"
check_sessiond
check_relayd
done
function cleanup()
{
diag "Cleaning up!"
- for p in ${APPS_PID}; do
- kill -s SIGKILL ${p}
- wait ${p} 2>/dev/null
- done
- APPS_PID=
+ kill -s SIGKILL "${APP_PIDS[@]}"
+ wait "${APP_PIDS[@]}" 2>/dev/null
+ APP_PIDS=()
+ # shellcheck disable=SC2119
stop_lttng_sessiond
+ # shellcheck disable=SC2119
stop_lttng_relayd
}
diag "Starting applications launcher"
# Start NR_APP applications script that will spawn apps non stop.
-./$TESTDIR/stress/$LAUNCH_APP $NR_APP &
-APPS_PID="${APPS_PID} ${!}"
+"./$TESTDIR/stress/$LAUNCH_APP" $NR_APP &
+APP_PIDS+=(${!})
test_stress
out=$?
fi
cleanup
-rm -rf $TRACE_PATH
+rm -rf "${TRACE_PATH:?}/"
rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD
exit 0
# SPDX-License-Identifier: LGPL-2.1-only
#
-CURDIR=$(dirname $0)/
-TESTDIR=$CURDIR/..
+CURDIR=$(dirname "$0")/
+TESTDIR="$CURDIR/.."
LAUNCH_APP="launch_ust_app"
KILL_RELAYD_HELPER="kill_relayd"
SESSION_NAME="stress"
NR_LOOP=100000
COREDUMP_FILE=$(cat /proc/sys/kernel/core_pattern)
NUM_TESTS=16
-APPS_PID=
+APP_PIDS=()
TEST_DESC="Stress test - $NR_SESSION sessions per UID streaming with $NR_APP apps. The relayd is killed sporadically"
-source $TESTDIR/utils/utils.sh
+# shellcheck source-path=SCRIPTDIR/../
+source "$TESTDIR/utils/utils.sh"
# MUST set TESTDIR before calling those functions
function enable_channel_per_uid()
{
- local sess_name=$1
- local channel_name=$2
+ local sess_name=$1
+ local channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel --buffers-uid -u $channel_name -s $sess_name >/dev/null 2>&1
- ok $? "Enable channel $channel_name per UID for session $sess_name"
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-channel --buffers-uid -u "$channel_name" -s "$sess_name" >/dev/null 2>&1
+ ok $? "Enable channel $channel_name per UID for session $sess_name"
}
function check_sessiond()
{
- if [ -z "$(lttng_pgrep lt-lttng-sessiond)" ]; then
- local str_date=$(date +%H%M%S-%d%m%Y)
+ local str_date
+ if [ -z "$(lttng_pgrep lttng-sessiond)" ]; then
+ str_date=$(date +%H%M%S-%d%m%Y)
diag "!!!The session daemon died unexpectedly!!!"
- mv $LOG_FILE_SESSIOND $LOG_FILE_SESSIOND-$str_date
- if [ -e $COREDUMP_FILE ]; then
- mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
+ mv $LOG_FILE_SESSIOND "$LOG_FILE_SESSIOND-$str_date"
+ if [ -e "$COREDUMP_FILE" ]; then
+ mv "$COREDUMP_FILE" "$COREDUMP_FILE-$str_date"
fi
exit 1
fi
function start_sessiond()
{
- validate_kernel_version
- if [ $? -ne 0 ]; then
+ if ! validate_kernel_version ; then
fail "Start session daemon"
BAIL_OUT "*** Kernel too old for session daemon tests ***"
fi
- if [ -z $(lttng_pgrep lt-$SESSIOND_BIN) ]; then
+ if [ -z "$(lttng_pgrep $SESSIOND_BIN)" ]; then
# We have to start it like this so the ulimit -c is used by this
# process. Also, we collect any error message printed out.
#$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --quiet --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
- $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --verbose-consumer -vvv --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
+ "$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN" --verbose-consumer -vvv --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
#$TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --consumerd32-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$TESTDIR/../src/bin/lttng-consumerd/lttng-consumerd" >$LOG_FILE_SESSIOND 2>&1
status=$?
ok $status "Start session daemon"
{
local opt=$1
- if [ -z $(lttng_pgrep lt-$RELAYD_BIN) ]; then
- $TESTDIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >$LOG_FILE_RELAYD 2>&1 &
+ if [ -z "$(lttng_pgrep $RELAYD_BIN)" ]; then
+ "$TESTDIR/../src/bin/lttng-relayd/$RELAYD_BIN" "$opt" >$LOG_FILE_RELAYD 2>&1 &
ok $? "Start lttng-relayd (opt: \"$opt\")"
fi
}
function check_relayd()
{
- if [ -z "$(lttng_pgrep lt-lttng-relayd)" ]; then
- local str_date=$(date +%H%M%S-%d%m%Y)
+ local str_date
+ if [ -z "$(lttng_pgrep lttng-relayd)" ]; then
+ str_date=$(date +%H%M%S-%d%m%Y)
#diag "Relay daemon died. Starting it again"
- if [ -e $COREDUMP_FILE ]; then
- mv $COREDUMP_FILE $COREDUMP_FILE-$str_date
+ if [ -e "$COREDUMP_FILE" ]; then
+ mv "$COREDUMP_FILE" "$COREDUMP_FILE-$str_date"
fi
start_relayd
fi
test_stress()
{
+ # shellcheck disable=SC2034
for b in $(seq 1 $NR_LOOP); do
for a in $(seq 1 $NR_SESSION); do
- create_lttng_session_uri $SESSION_NAME-$a net://localhost
+ create_lttng_session_uri $SESSION_NAME-"$a" net://localhost
check_sessiond
check_relayd
- enable_channel_per_uid $SESSION_NAME-$a $CHANNEL_NAME
+ enable_channel_per_uid $SESSION_NAME-"$a" $CHANNEL_NAME
check_sessiond
check_relayd
- enable_ust_lttng_event_ok $SESSION_NAME-$a $EVENT_NAME
+ enable_ust_lttng_event_ok $SESSION_NAME-"$a" $EVENT_NAME
check_sessiond
check_relayd
- start_lttng_tracing_ok $SESSION_NAME-$a
+ start_lttng_tracing_ok $SESSION_NAME-"$a"
check_sessiond
check_relayd
done
for a in $(seq 1 $NR_SESSION); do
- stop_lttng_tracing_ok $SESSION_NAME-$a
+ stop_lttng_tracing_ok $SESSION_NAME-"$a"
check_sessiond
check_relayd
- destroy_lttng_session_ok $SESSION_NAME-$a
+ destroy_lttng_session_ok $SESSION_NAME-"$a"
check_sessiond
check_relayd
done
function cleanup()
{
diag "Cleaning up!"
- for p in ${APPS_PID}; do
- kill ${p}
- wait ${p} 2>/dev/null
- done
- APPS_PID=
+ kill "${APP_PIDS[@]}"
+ wait "${APP_PIDS[@]}" 2>/dev/null
+ APP_PIDS=()
+ # shellcheck disable=SC2119
stop_lttng_sessiond
+ # shellcheck disable=SC2119
stop_lttng_relayd
}
diag "Starting applications launcher"
# Start NR_APP applications script that will spawn apps non stop.
-./$TESTDIR/stress/$LAUNCH_APP $NR_APP &
-APPS_PID="${APPS_PID} ${!}"
+"./$TESTDIR/stress/$LAUNCH_APP" $NR_APP &
+APP_PIDS+=(${!})
# Launch the helper script that will randomly kill the relayd at vitam eternam.
-./$TESTDIR/stress/$KILL_RELAYD_HELPER 1 1 &
-APPS_PID="${APPS_PID} ${!}"
+"./$TESTDIR/stress/$KILL_RELAYD_HELPER" 1 1 &
+APP_PIDS+=(${!})
test_stress
out=$?
fi
cleanup
-rm -rf $TRACE_PATH
+rm -rf "${TRACE_PATH:?}/"
rm $LOG_FILE_SESSIOND $LOG_FILE_RELAYD
exit 0