RELAYD_MATCH=".*lttng-relayd.*"
LTTNG_BIN="lttng"
BABELTRACE_BIN="babeltrace2"
-OUTPUT_DEST=/dev/null
-ERROR_OUTPUT_DEST=/dev/null
+LTTNG_TEST_LOG_DIR="${LTTNG_TEST_LOG_DIR:-}"
+LTTNG_TEST_VERBOSE_BABELTRACE="${LTTNG_TEST_VERBOSE_BABELTRACE:-}"
+LTTNG_TEST_BABELTRACE_VERBOSITY="${LTTNG_TEST_BABELTRACE_VERBOSITY:-I}"
+LTTNG_TEST_VERBOSE_CLIENT="${LTTNG_TEST_VERBOSE_CLIENT:-}"
+LTTNG_TEST_VERBOSE_RELAYD="${LTTNG_TEST_VERBOSE_RELAYD:-}"
+LTTNG_TEST_VERBOSE_SESSIOND="${LTTNG_TEST_VERBOSE_SESSIOND:-}"
+OUTPUT_DEST="${OUTPUT_DEST:-}" # For 'lttng', some scripts set this to catch a command output
+ERROR_OUTPUT_DEST="${ERROR_OUTPUT_DEST:-}" # For 'lttng', some scripts set this to catch a command error output
MI_XSD_MAJOR_VERSION=4
MI_XSD_MINOR_VERSION=1
MI_XSD_PATH="$TESTDIR/../src/common/mi-lttng-${MI_XSD_MAJOR_VERSION}.${MI_XSD_MINOR_VERSION}.xsd"
PGREP=pgrep
fi
+function _lttng_client_log_file ()
+{
+ local output_dest="${1}"
+ if [[ -n "${output_dest}" ]]; then
+ if [[ "${output_dest}" != "-" ]]; then
+ echo "${output_dest}"
+ fi
+ elif [[ -n "${LTTNG_TEST_LOG_DIR}" ]]; then
+ if [[ "${LTTNG_TEST_LOG_DIR}" != "-" ]]; then
+ mktemp -p "${LTTNG_TEST_LOG_DIR}" "lttng.XXXXXX"
+ fi
+ else
+ echo "/dev/null"
+ fi
+}
+
+function lttng_client_log_file ()
+{
+ _lttng_client_log_file "${OUTPUT_DEST}"
+}
+
+function lttng_client_err_file ()
+{
+ _lttng_client_log_file "${ERROR_OUTPUT_DEST}"
+}
+
+function lttng_log_file ()
+{
+ local app="${1:-}"
+ if [[ -z "${app}" ]] || [[ -z "${LTTNG_TEST_LOG_DIR}" ]]; then
+ echo "/dev/null"
+ return
+ fi
+
+ if [[ "${LTTNG_TEST_LOG_DIR}" == "-" ]]; then
+ return
+ fi
+
+ mktemp -p "${LTTNG_TEST_LOG_DIR}" "${app}.XXXXXX.log"
+}
+
# Due to the renaming of threads we need to use the full command (pgrep -f) to
# identify the pids for multiple lttng related processes. The problem with "pgrep
# -f" is that it ends up also looking at the arguments. We use a two stage
fi
# Check for builtin modules.
- ls /proc/lttng > /dev/null 2>&1
+ ls /proc/lttng >/dev/null 2>&1
if [ $? -eq 0 ]; then
return 0
fi
LTTNG_BAIL_OUT "LTTng modules not detected."
}
+# Run the babeltrace binary
+function _run_babeltrace_cmd ()
+{
+ local err_log
+ local opts
+
+ err_log="$(lttng_log_file babeltrace.err)"
+
+ opts=("${@}")
+ if [[ -n "${LTTNG_TEST_VERBOSE_BABELTRACE}" ]]; then
+ opts=('-l' "${LTTNG_TEST_BABELTRACE_VERBOSITY}" "${opts[@]}")
+ fi
+
+ diag "${BABELTRACE_BIN} ${opts[*]} # Error log: '${err_log:-N/A}'" >&2
+ if [[ -n "${err_log}" ]]; then
+ "${BABELTRACE_BIN}" "${opts[@]}" 2>"${err_log}"
+ else
+ "${BABELTRACE_BIN}" "${opts[@]}"
+ fi
+}
+
# Run the lttng binary.
#
# The first two arguments are stdout and stderr redirect paths, respectively.
local stderr_dest="$2"
shift 2
- diag "$TESTDIR/../src/bin/lttng/$LTTNG_BIN $*"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN "$@" 1> "$stdout_dest" 2> "$stderr_dest"
+ opts=("${@}")
+ if [[ -n "${LTTNG_TEST_VERBOSE_CLIENT}" ]] ; then
+ opts=('-vvv' "${opts[@]}")
+ fi
+
+ diag "$TESTDIR/../src/bin/lttng/$LTTNG_BIN ${opts[*]}"
+ if [[ -n "${stdout_dest}" ]] && [[ -n "${stderr_dest}" ]] ; then
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN "${opts[@]}" >"${stdout_dest}" 2>"${stderr_dest}"
+ elif [[ -n "${stdout_dest}" ]] && [[ -z "${stderr_dest}" ]]; then
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN "${opts[@]}" >"${stdout_dest}"
+ elif [[ -z "${stdout_dest}" ]] && [[ -n "${stderr_dest}" ]] ; then
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN "${opts[@]}" 2>"${stderr_dest}"
+ else
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN "${opts[@]}"
+ fi
}
function enable_kernel_lttng_event
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event "$event_name" $chan -s $sess_name -k
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event --syscall "$syscall_name" $chan -s $sess_name -k
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
disable-event --syscall "$syscall_name" $chan -s $sess_name -k
ret=$?
local target="$3"
local event_name="$4"
- "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-event --kernel --function="$target" "$event_name" -s "$sess_name" > "$OUTPUT_DEST" 2> "$ERROR_OUTPUT_DEST"
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-event --kernel --function="$target" "$event_name" -s "$sess_name" >"$(lttng_client_log_file)" 2>"$(lttng_client_err_file)"
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test $ret -ne "0"
local target="$3"
local event_name="$4"
- "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-event --kernel --userspace-probe="$target" "$event_name" -s "$sess_name" > "$OUTPUT_DEST" 2> "$ERROR_OUTPUT_DEST"
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" enable-event --kernel --userspace-probe="$target" "$event_name" -s "$sess_name" >"$(lttng_client_log_file)" 2>"$(lttng_client_err_file)"
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test $ret -ne "0"
local sess_name="$1"
local event_name="$2"
- "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" disable-event --kernel "$event_name" -s "$sess_name" > "$OUTPUT_DEST" 2> "$ERROR_OUTPUT_DEST"
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" disable-event --kernel "$event_name" -s "$sess_name" >"$(lttng_client_log_file)" 2>"$(lttng_client_err_file)"
ok $? "Disable kernel event $target for session $sess_name"
}
function lttng_enable_kernel_channel()
local channel_name=$4
local opts="${@:5}"
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-channel -k $channel_name -s $sess_name $opts
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local sess_name=$2
local channel_name=$3
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
disable-channel -k $channel_name -s $sess_name
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
{
local withtap=$1
local process_mode=$2
- local opt=$3
+ shift 2 || true
+ # This is intentionally not quoted inside the array so something like '-o /tmp/x' is split
+ # shellcheck disable=SC2206
+ local opts=(${@})
+ local log_file="${RELAYD_ERROR_OUTPUT_DEST:-$(lttng_log_file relayd)}"
DIR=$(readlink -f "$TESTDIR")
+ if [[ -n "${LTTNG_TEST_VERBOSE_RELAYD}" ]] ; then
+ opts+=('-vvv')
+ fi
+
+ if [[ -n "${log_file}" ]] ; then
+ diag "Relayd log file: ${log_file}"
+ fi
+
if [ -z $(lttng_pgrep "$RELAYD_MATCH") ]; then
# shellcheck disable=SC2086
- $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $process_mode $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
- #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $process_mode $opt -vvv >>/tmp/relayd.log 2>&1 &
- if [ $? -eq 1 ]; then
- if [ $withtap -eq "1" ]; then
- fail "Start lttng-relayd (process mode: $process_mode opt: $opt)"
- fi
- return 1
+ if [[ -n "${log_file}" ]]; then
+ $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $process_mode "${opts[@]}" >"${log_file}" 2>&1
else
- if [ $withtap -eq "1" ]; then
- pass "Start lttng-relayd (process mode: $process_mode opt: $opt)"
- fi
+ $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $process_mode "${opts[@]}"
+ fi
+ local ret="${?}"
+ if [ $withtap -eq "1" ]; then
+ ok $ret "Start lttng-relayd (process mode: $process_mode opt: ${opts[*]})"
+ else
+ return $ret
fi
else
- pass "Start lttng-relayd (opt: $opt)"
+ pass "Start lttng-relayd (opt: ${opts[*]})"
fi
}
diag "Killing (signal $signal) lttng-relayd (pid: $pids)"
# shellcheck disable=SC2086
- if ! kill -s $signal $pids 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST; then
+ if ! kill -s $signal $pids; then
retval=1
if [ "$withtap" -eq "1" ]; then
fail "Kill relay daemon"
# The rest of the arguments will be passed directly to lttng-sessiond.
shift 2
+ local opts=("${@}")
+ local log_file="$(lttng_log_file sessiond)"
local env_vars=""
local consumerd=""
return
fi
+ if [[ -n "${LTTNG_TEST_VERBOSE_SESSIOND}" ]]; then
+ opts+=(
+ '-vvv'
+ '--verbose-consumer'
+ )
+ fi
+
DIR=$(readlink -f "$TESTDIR")
# Get long_bit value for 32/64 consumerd
env_vars="${env_vars}$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN"
if ! validate_kernel_version; then
- fail "Start session daemon"
- LTTNG_BAIL_OUT "*** Kernel too old for session daemon tests ***"
+ fail "Start session daemon"
+ LTTNG_BAIL_OUT "*** Kernel too old for session daemon tests ***"
fi
diag "export LTTNG_SESSION_CONFIG_XSD_PATH=${DIR}/../src/common/"
if [ -z "$(lttng_pgrep "${SESSIOND_MATCH}")" ]; then
# Have a load path ?
if [ -n "$load_path" ]; then
- diag "env $env_vars --load $load_path --background $consumerd $@"
- # shellcheck disable=SC2086
- env $env_vars --load "$load_path" --background "$consumerd" "$@"
+ diag "env $env_vars --load $load_path --background $consumerd ${opts[*]}"
+ if [[ -n "${log_file}" ]]; then
+ # shellcheck disable=SC2086
+ env $env_vars --load "$load_path" --background "$consumerd" "${opts[@]}" >"${log_file}" 2>&1
+ else
+ # shellcheck disable=SC2086
+ env $env_vars --load "$load_path" --background "$consumerd" "${opts[@]}"
+ fi
else
- diag "env $env_vars --background $consumerd $@"
- # shellcheck disable=SC2086
- env $env_vars --background "$consumerd" "$@"
+ diag "env $env_vars --background $consumerd ${opts[*]}"
+ if [[ -n "${log_file}" ]]; then
+ # shellcheck disable=SC2086
+ env $env_vars --background "$consumerd" "${opts[@]}" >"${log_file}" 2>&1
+ else
+ # shellcheck disable=SC2086
+ env $env_vars --background "$consumerd" "${opts[@]}"
+ fi
fi
- #$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --verbose-consumer >>/tmp/sessiond.log 2>&1
status=$?
if [ "$withtap" -eq "1" ]; then
ok $status "Start session daemon"
diag "Killing (signal $signal) $SESSIOND_BIN and lt-$SESSIOND_BIN pids: $(echo "$pids" | tr '\n' ' ')"
# shellcheck disable=SC2086
- if ! kill -s $signal $pids 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST; then
+ if ! kill -s $signal $pids; then
retval=1
if [ "$withtap" -eq "1" ]; then
fail "Kill sessions daemon"
fi
# shellcheck disable=SC2086
- if ! kill -s $signal $pids 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST; then
+ if ! kill -s $signal $pids; then
if [ "$withtap" -eq "1" ]; then
fail "Sending SIGSTOP to session daemon"
fi
diag "Killing (signal $signal) $CONSUMERD_BIN pids: $(echo "$pids" | tr '\n' ' ')"
# shellcheck disable=SC2086
- if ! kill -s $signal $pids 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST; then
+ if ! kill -s $signal $pids; then
retval=1
if [ "$withtap" -eq "1" ]; then
fail "Kill consumer daemon"
diag "Sending SIGSTOP to $CONSUMERD_BIN pids: $(echo "$pids" | tr '\n' ' ')"
# shellcheck disable=SC2086
- kill -s $signal $pids 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+ kill -s $signal $pids
retval=$?
if [ $retval -eq 1 ]; then
local withtap=$1
shift
local opts=$1
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
list $opts
ret=$?
if [ $withtap -eq "1" ]; then
local sess_name=$1
local opts="${@:2}"
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
create $sess_name --no-output $opts
ok $? "Create session $sess_name in no-output mode"
}
local uri=$2
local opts="${@:3}"
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
create $sess_name -U $uri $opts
ok $? "Create session $sess_name with uri:$uri and opts: $opts"
}
trace_path="-o $trace_path"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
create "$sess_name" $trace_path $opt
ret=$?
if [ $expected_to_fail -eq "1" ]; then
local channel_name=$4
local opts="${@:5}"
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-channel -u $channel_name -s $sess_name $opts
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local sess_name=$1
local channel_name=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
disable-channel -u $channel_name -s $sess_name
ok $? "Disable channel $channel_name for session $sess_name"
}
local sess_name=$1
local channel_name=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-channel -s $sess_name $channel_name -k --output mmap --overwrite
ok $? "Enable channel $channel_name for session $sess_name"
}
local sess_name=$1
local channel_name=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-channel -s $sess_name $channel_name -k --output mmap --discard --subbuf-size=$(getconf PAGE_SIZE) --num-subbuf=2
ok $? "Enable small discard channel $channel_name for session $sess_name"
}
local sess_name=$1
local channel_name=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-channel -s $sess_name $channel_name -k --output mmap --overwrite --subbuf-size=$(getconf PAGE_SIZE) --num-subbuf=2
ok $? "Enable small overwrite channel $channel_name for session $sess_name"
}
local sess_name=$1
local channel_name=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-channel -s $sess_name $channel_name -u --output mmap --overwrite
ok $? "Enable channel $channel_name for session $sess_name"
}
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event "$event_name" $chan -s "$sess_name" -u
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event "$event_name" $chan -s $sess_name -j
ok $? "Enable JUL event $event_name for session $sess_name"
}
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event --loglevel $loglevel "$event_name" $chan -s $sess_name -j
ok $? "Enable JUL event $event_name for session $sess_name with loglevel $loglevel"
}
chan_opt=("-c" "$channel_name")
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event "$event_name" "${chan_opt[@]}" -s "$sess_name" --log4j
ok $? "Enable LOG4J event '$event_name' for session '$sess_name'"
}
local event_name=$2
local filter=$3
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event "$event_name" -s "$sess_name" --log4j --filter "$filter"
ok $? "Enable LOG4J event '$event_name' with filter '$filter' for session '$sess_name'"
}
local filter=$3
local loglevel=$4
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event --loglevel-only "$loglevel" "$event_name" -s "$sess_name" -l --filter "$filter"
ok $? "Enable LOG4J event '$event_name' with filter '$filter' and loglevel-only '$loglevel' for session '$sess_name'"
}
chan_opt=("-c" "$channel_name")
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event --loglevel "$loglevel" "$event_name" "${chan_opt[@]}" -s "$sess_name" --log4j
ok $? "Enable LOG4J event '$event_name' for session '$sess_name' with loglevel '$loglevel'"
}
chan_opt=("-c" "$channel_name")
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event --loglevel-only "$loglevel" "$event_name" "${chan_opt[@]}" -s "$sess_name" --log4j
ok $? "Enable LOG4J event '$event_name' for session '$sess_name' with loglevel-only '$loglevel'"
}
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event "$event_name" $chan -s $sess_name -p
ok $? "Enable Python event $event_name for session $sess_name"
}
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event --loglevel $loglevel "$event_name" $chan -s $sess_name -p
ok $? "Enable Python event $event_name for session $sess_name with loglevel $loglevel"
}
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event $chan "$event_name" -s $sess_name -u --filter "$filter"
ok $? "Enable event $event_name with filtering for session $sess_name"
}
chan=('-c' "${channel_name}")
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event "${chan[@]}" "$event_name" -s "${sess_name}" -u --loglevel="${loglevel}"
ok $? "Enable event $event_name with loglevel $loglevel"
}
chan=('-c' "${channel_name}")
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-event "${chan[@]}" "$event_name" -s "${sess_name}" -u --loglevel-only "${loglevel}"
ok $? "Enable event $event_name with loglevel-only $loglevel"
}
chan="-c $channel_name"
fi
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
disable-event "$event_name" -s $sess_name $chan -u
ok $? "Disable event $event_name for session $sess_name"
}
local sess_name="$1"
local event_name="$2"
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
disable-event "$event_name" -s "$sess_name" --log4j
ok $? "Disable LOG4J event '$event_name' for session '$sess_name'"
}
local sess_name="$1"
local event_name="$2"
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
disable-event "$event_name" -s $sess_name -p
ok $? "Disable Python event $event_name for session $sess_name"
}
local expected_to_fail=$2
local sess_name=$3
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
start $sess_name
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local expected_to_fail=$2
local sess_name=$3
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
stop $sess_name
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local sess_name=$3
shift 3
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
destroy $sess_name $@
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
function destroy_lttng_sessions ()
{
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
destroy --all
ok $? "Destroy all lttng sessions"
}
local trace_path=$3
local opts=$4
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
snapshot add-output -s $sess_name $trace_path $opts
ret=$?
if [[ $expected_to_fail -eq 1 ]]; then
local sess_name=$2
local id=$3
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
snapshot del-output -s $sess_name $id
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local sess_name=$1
local trace_path=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
snapshot record -s "$sess_name" "$trace_path"
ok $? "Snapshot recorded"
}
function lttng_snapshot_list ()
{
local sess_name=$1
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
snapshot list-output -s $sess_name
ok $? "Snapshot list"
}
local sess_name=$1
local opts=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
save $sess_name $opts
ok $? "Session saved"
}
local expected_to_fail=$1
local opts=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
load $opts
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local expected_to_fail="$1"
shift 1
local opts="$@"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN track $opts >$OUTPUT_DEST
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN track $opts >"$(lttng_client_log_file)"
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test $ret -ne "0"
local expected_to_fail="$1"
shift 1
local opts="$@"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN untrack $opts >$OUTPUT_DEST
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN untrack $opts >"$(lttng_client_log_file)"
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test $ret -ne "0"
function lttng_track_pid_ok()
{
PID=$1
- "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" track --kernel --pid=$PID 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" track --kernel --pid=$PID 1>"$(lttng_client_log_file)" 2>"$(lttng_client_err_file)"
ok $? "Lttng track pid on the kernel domain"
}
function lttng_untrack_kernel_all_ok()
{
- "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" untrack --kernel --pid --all 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+ "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" untrack --kernel --pid --all 1>"$(lttng_client_log_file)" 2>"$(lttng_client_err_file)"
ok $? "Lttng untrack all pid on the kernel domain"
}
function lttng_add_context_list()
{
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
add-context --list
ret=$?
ok $ret "Context listing"
local channel_name="$4"
local type="$5"
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
add-context -s $session_name -c $channel_name -t $type $domain
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
diag "Waiting for live trace at url: $url"
while [ $zero_client_match -eq 0 ]; do
- zero_client_match=$($BABELTRACE_BIN -i lttng-live $url | grep "0 client(s) connected" | wc -l)
+ zero_client_match=$(_run_babeltrace_cmd -i lttng-live $url | grep "0 client(s) connected" | wc -l)
sleep 0.1
done
pass "Waiting for live trace at url: $url"
diag "Waiting for live viewers on url: $url"
while [ $one_client_match -eq 0 ]; do
- one_client_match=$($BABELTRACE_BIN -i lttng-live $url | grep "1 client(s) connected" | wc -l)
+ one_client_match=$(_run_babeltrace_cmd -i lttng-live $url | grep "1 client(s) connected" | wc -l)
sleep 0.1
done
pass "Waiting for live viewers on url: $url"
bail_out_if_no_babeltrace
- count=$($BABELTRACE_BIN --output-format=ctf-metadata "$metadata_path" | grep -c "$event_name")
+ count=$(_run_babeltrace_cmd --output-format=ctf-metadata "$metadata_path" | grep -c "$event_name")
test "$count" -eq "$expected"
ok $? "Found $count / $expected metadata event id matching '$event_name'"
bail_out_if_no_babeltrace
- count=$($BABELTRACE_BIN "$trace_path" | grep -c "$event_name")
- total=$($BABELTRACE_BIN "$trace_path" | wc -l)
+ count=$(_run_babeltrace_cmd "$trace_path" | grep -c "$event_name")
+ total=$(_run_babeltrace_cmd "$trace_path" | wc -l)
test "$count" -eq "$expected"
bail_out_if_no_babeltrace
- count=$($BABELTRACE_BIN "$trace_path" | grep -c "$event_name")
- total=$($BABELTRACE_BIN "$trace_path" | wc -l)
+ count=$(_run_babeltrace_cmd "$trace_path" | grep -c "$event_name")
+ total=$(_run_babeltrace_cmd "$trace_path" | wc -l)
test "$expected" -eq "$count" && test "$total" -eq "$expected"
IFS=","
for event_name in $event_names; do
# trace_path is unquoted since callers make use of globbing
- count=$($BABELTRACE_BIN $trace_path | grep -c "$event_name")
+ count=$(_run_babeltrace_cmd $trace_path | grep -c "$event_name")
test "$count" -gt 0
ok $? "Found $count events matching '$event_name'"
done
OLDIFS=$IFS
IFS=","
for event_name in $event_names; do
- count=$($BABELTRACE_BIN "$trace_path" | grep -c "$event_name")
+ count=$(_run_babeltrace_cmd "$trace_path" | grep -c "$event_name")
test "$count" -gt 0
ok $? "Found '$count' events matching '$event_name'"
total=$(( total + count ))
OLDIFS=$IFS
IFS=","
for event_name in $event_names; do
- count=$($BABELTRACE_BIN "$trace_path" | grep -c "$event_name")
+ count=$(_run_babeltrace_cmd "$trace_path" | grep -c "$event_name")
test "$count" -ge "$expected_min"
ok $? "Found $count events matching '$event_name', expected at least $expected_min"
total=$(( total + count ))
{
local trace_path=$1
- $BABELTRACE_BIN "$trace_path" | head -n 1
+ _run_babeltrace_cmd "$trace_path" | head -n 1
}
# Check that the trace contains at least 1 event matching the grep extended
bail_out_if_no_babeltrace
# event_exp is unquoted since it contains multiple grep arguments
- count=$($BABELTRACE_BIN "$trace_path" | grep -c --extended-regexp $event_exp)
+ count=$(_run_babeltrace_cmd "$trace_path" | grep -c --extended-regexp $event_exp)
test "$count" -gt 0
ok $? "Found $count events matching expression '$event_exp'"
}
bail_out_if_no_babeltrace
# event_exp is unquoted since it contains multiple grep arguments
- count=$($BABELTRACE_BIN "$trace_path" | grep -c --extended-regexp $event_exp)
- total=$($BABELTRACE_BIN "$trace_path" | wc -l)
+ count=$(_run_babeltrace_cmd "$trace_path" | grep -c --extended-regexp $event_exp)
+ total=$(_run_babeltrace_cmd "$trace_path" | wc -l)
test "$count" -gt 0 && test "$total" -eq "$count"
ok $? "Found $count events matching expression '$event_exp' amongst $total events"
bail_out_if_no_babeltrace
- events=$($BABELTRACE_BIN "$trace_path")
+ events=$(_run_babeltrace_cmd "$trace_path")
ret=$?
if [ $ret -ne 0 ]; then
fail "Failed to parse trace"
local expected_to_fail=$1
local sess_name=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
regenerate metadata -s $sess_name
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local expected_to_fail=$1
local sess_name=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
regenerate statedump -s $sess_name
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local expected_to_fail=$1
local sess_name=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
rotate $sess_name
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local sess_name=$2
local period=$3
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-rotation -s $sess_name --timer $period
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local sess_name=$2
local size=$3
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
enable-rotation -s $sess_name --size $size
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
local expected_to_fail=$1
local sess_name=$2
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
clear $sess_name
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
function lttng_clear_all ()
{
- _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
+ _run_lttng_cmd "$(lttng_client_log_file)" "$(lttng_client_err_file)" \
clear --all
ok $? "Clear all lttng sessions"
}