X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=8cb664dd5c51a4c0bc116cbfa6c00eed2980a983;hb=28e9df91c0ebda73a60579b6187bba4c14c92d43;hp=6421af1b5c5ed47dc02c67e3703b737d18aa250a;hpb=6f137cef6cb86bf40f973d62f744536f91926ad3;p=lttng-tools.git diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 6421af1b5..8cb664dd5 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -121,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 } @@ -155,6 +166,8 @@ 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 --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" @@ -280,6 +293,24 @@ function enable_jul_lttng_event() 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" @@ -319,6 +350,15 @@ function disable_ust_lttng_event () ok $? "Disable event $event_name for session $sess_name" } +function disable_jul_lttng_event () +{ + local sess_name="$1" + local event_name="$2" + + $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-event "$event_name" -s $sess_name -j >/dev/null 2>&1 + ok $? "Disable JUL event $event_name for session $sess_name" +} + function start_lttng_tracing () { sess_name=$1 @@ -371,6 +411,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 @@ -415,3 +472,23 @@ function validate_trace IFS=$OLDIFS return $ret } + +function trace_match_only() +{ + local event_name=$1 + local nr_iter=$2 + local trace_path=$3 + + which $BABELTRACE_BIN >/dev/null + skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches" + + local count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l) + local total=$($BABELTRACE_BIN $trace_path | wc -l) + + if [ "$nr_iter" -eq "$count" ] && [ "$total" -eq "$nr_iter" ]; then + pass "Trace match with $total event $event_name" + else + fail "Trace match" + diag "$total event(s) found, expecting $nr_iter of event $event_name and only found $count" + fi +}