X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=a8b9b3bdf5e76718f0aca85991868809a3ed9eda;hb=5f0d4e78e640b8baaf900fe52f491155ad6d8168;hp=71ddaa2cb5ea5a5c0e814eb307d201dcb2189817;hpb=529bb942d15366eacc37f14df5d4404dfcd64893;p=lttng-tools.git diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 71ddaa2cb..a8b9b3bdf 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -66,11 +66,24 @@ function full_cleanup () # The '-' before the pid number ($$) indicates 'kill' to signal the # whole process group. trap - SIGTERM && kill -- -$$ + exit 1 } +function null_pipes () +{ + exec 0>/dev/null + exec 1>/dev/null + exec 2>/dev/null +} trap full_cleanup SIGINT SIGTERM +# perl prove closes its child pipes before giving it a chance to run its +# signal trap handlers. Redirect pipes to /dev/null if SIGPIPE is caught +# to allow those trap handlers to proceed. + +trap null_pipes SIGPIPE + function print_ok () { # Check if we are a terminal @@ -384,22 +397,23 @@ function lttng_disable_kernel_channel_fail() function start_lttng_relayd_opt() { local withtap=$1 - local opt=$2 + local process_mode=$2 + local opt=$3 DIR=$(readlink -f "$TESTDIR") - if [ -z "$(pgrep "$RELAYD_MATCH")" ]; then + if [ -z $(pgrep $RELAYD_MATCH) ]; then # shellcheck disable=SC2086 - "$DIR/../src/bin/lttng-relayd/$RELAYD_BIN" -b $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST - #"$DIR/../src/bin/lttng-relayd/$RELAYD_BIN" $opt -vvv >>/tmp/relayd.log 2>&1 & + $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $process_mode $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST + #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 & if [ $? -eq 1 ]; then - if [ "$withtap" -eq "1" ]; then - fail "Start lttng-relayd (opt: $opt)" + if [ $withtap -eq "1" ]; then + fail "Start lttng-relayd (process mode: $process_mode opt: $opt)" fi return 1 else - if [ "$withtap" -eq "1" ]; then - pass "Start lttng-relayd (opt: $opt)" + if [ $withtap -eq "1" ]; then + pass "Start lttng-relayd (process mode: $process_mode opt: $opt)" fi fi else @@ -409,12 +423,12 @@ function start_lttng_relayd_opt() function start_lttng_relayd() { - start_lttng_relayd_opt 1 "$@" + start_lttng_relayd_opt 1 "-b" "$@" } function start_lttng_relayd_notap() { - start_lttng_relayd_opt 0 "$@" + start_lttng_relayd_opt 0 "-b" "$@" } function stop_lttng_relayd_opt() @@ -887,7 +901,14 @@ function create_lttng_session () local trace_path=$4 local opt=$5 - $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path $opt > $OUTPUT_DEST + if [ -z "$trace_path" ]; then + # Use lttng-sessiond default output. + trace_path="" + else + trace_path="-o $trace_path" + fi + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN create "$sess_name" $trace_path $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST ret=$? if [ $expected_to_fail -eq "1" ]; then test "$ret" -ne "0" @@ -1783,7 +1804,7 @@ function regenerate_statedump () test "$ret" -ne "0" ok $? "Expected fail on regenerate statedump $sess_name" else - ok $ret "Metadata regenerate $sess_name" + ok $ret "Statedump regenerate $sess_name" fi }