X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=280cc40e0a5fb0d2c78f730c83f717ba952ca45f;hb=b02dcdb88f016e831400e6b2a86130035197e1eb;hp=9e2c12d0be68de3cd2c8f6bd5d43a532bf6c3b78;hpb=df442a141af71cd983f04a5d4d59002c82b0dacd;p=lttng-tools.git diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 9e2c12d0b..280cc40e0 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -16,6 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA SESSIOND_BIN="lttng-sessiond" +CONSUMERD_BIN="lttng-consumerd" RELAYD_BIN="lttng-relayd" LTTNG_BIN="lttng" BABELTRACE_BIN="babeltrace" @@ -107,7 +108,7 @@ function start_lttng_relayd DIR=$(readlink -f $TESTDIR) if [ -z $(pidof lt-$RELAYD_BIN) ]; then - $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1 & + $DIR/../src/bin/lttng-relayd/$RELAYD_BIN -b $opt >/dev/null 2>&1 #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 & if [ $? -eq 1 ]; then fail "Start lttng-relayd (opt: $opt)" @@ -120,22 +121,33 @@ function start_lttng_relayd fi } -function stop_lttng_relayd +function stop_lttng_relayd_nocheck { PID_RELAYD=`pidof lt-$RELAYD_BIN` + diag "Killing lttng-relayd (pid: $PID_RELAYD)" kill $PID_RELAYD >/dev/null 2>&1 + retval=$? - if [ $? -eq 1 ]; then - fail "Kill lttng-relayd (pid: $PID_RELAYD)" - return 1 - else + if [ $retval -eq 1 ]; then out=1 while [ -n "$out" ]; do out=$(pidof lt-$RELAYD_BIN) sleep 0.5 done - pass "Kill lttng-relayd (pid: $PID_RELAYD)" + fi + return $retval +} + +function stop_lttng_relayd +{ + stop_lttng_relayd_nocheck + + if [ $? -eq 1 ]; then + fail "Killed lttng-relayd (pid: $PID_RELAYD)" + return 1 + else + pass "Killed lttng-relayd (pid: $PID_RELAYD)" return 0 fi } @@ -154,9 +166,11 @@ function start_lttng_sessiond() fi DIR=$(readlink -f $TESTDIR) + : ${LTTNG_SESSION_CONFIG_XSD_PATH=${DIR}/../src/common/config/} + export LTTNG_SESSION_CONFIG_XSD_PATH if [ -z $(pidof lt-$SESSIOND_BIN) ]; then - $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" + $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" #$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --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=$? ok $status "Start session daemon" @@ -183,6 +197,11 @@ function stop_lttng_sessiond () out=$(pidof lt-$SESSIOND_BIN) sleep 0.5 done + out=1 + while [ -n "$out" ]; do + out=$(pidof $CONSUMERD_BIN) + sleep 0.5 + done pass "Kill session daemon" fi } @@ -257,6 +276,41 @@ function enable_ust_lttng_event () ok $? "Enable event $event_name for session $sess_name" } +function enable_jul_lttng_event() +{ + sess_name=$1 + event_name="$2" + channel_name=$3 + + if [ -z $channel_name ]; then + # default channel if none specified + chan="" + else + chan="-c $channel_name" + fi + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -j >/dev/null 2>&1 + ok $? "Enable JUL event $event_name for session $sess_name" +} + +function enable_jul_lttng_event_loglevel() +{ + sess_name=$1 + event_name="$2" + loglevel=$3 + channel_name=$4 + + if [ -z $channel_name ]; then + # default channel if none specified + chan="" + else + chan="-c $channel_name" + fi + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event --loglevel $loglevel "$event_name" $chan -s $sess_name -j >/dev/null 2>&1 + ok $? "Enable JUL event $event_name for session $sess_name with loglevel $loglevel" +} + function enable_ust_lttng_event_filter() { sess_name="$1" @@ -348,6 +402,23 @@ function lttng_snapshot_record () ok $? "Snapshot recorded" } +function lttng_save() +{ + local sess_name=$1 + local opts=$2 + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN save $sess_name $opts >/dev/null 2>&1 + ok $? "Session successfully saved" +} + +function lttng_load() +{ + local opts=$1 + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN load $opts >/dev/null 2>&1 + ok $? "Load command successful" +} + function trace_matches () { event_name=$1