echo
}
-function lttng_enable_kernel_event
+function enable_kernel_lttng_event
{
- local sess_name=$1
- local event_name=$2
- local channel_name=$3
+ local expected_to_fail="$1"
+ local sess_name="$2"
+ local event_name="$3"
+ local channel_name="$4"
- if [ -z $event_name ]; then
+ if [ -z "$event_name" ]; then
# Enable all event if no event name specified
event_name="-a"
fi
- if [ -z $channel_name ]; then
+ if [ -z "$channel_name" ]; then
# default channel if none specified
chan=""
else
fi
$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -k 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
- ok $? "Enable kernel event $event_name for session $sess_name"
+ ret=$?
+ if [[ $expected_to_fail -eq "1" ]]; then
+ test $ret -ne "0"
+ ok $? "Enable kernel event $event_name for session $session_name on channel $channel_name failed as expected"
+ else
+ ok $ret "Enable kernel event $event_name for session $sess_name"
+ fi
+}
+
+function enable_kernel_lttng_event_ok ()
+{
+ enable_kernel_lttng_event 0 "$@"
+}
+
+function enable_kernel_lttng_event_fail ()
+{
+ enable_kernel_lttng_event 1 "$@"
+}
+
+# Old interface
+function lttng_enable_kernel_event
+{
+ enable_kernel_lttng_event_ok "$@"
}
function lttng_enable_kernel_syscall()
function stop_lttng_sessiond_opt()
{
local withtap=$1
+ local signal=$2
+ local kill_opt=""
if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then
# Env variable requested no session daemon
PID_SESSIOND=`pidof lt-$SESSIOND_BIN`
- kill $PID_SESSIOND 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+ if [ -n "$2" ]; then
+ kill_opt="$kill_opt -s $signal"
+ fi
+
+ kill $kill_opt $PID_SESSIOND 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
if [ $? -eq 1 ]; then
if [ $withtap -eq "1" ]; then
stop_lttng_sessiond_opt 0 "$@"
}
+function stop_lttng_consumerd_opt()
+{
+ local withtap=$1
+ local signal=$2
+ local kill_opt=""
+
+ PID_CONSUMERD=`pidof $CONSUMERD_BIN`
+
+ if [ -n "$2" ]; then
+ kill_opt="$kill_opt -s $signal"
+ fi
+
+ if [ $withtap -eq "1" ]; then
+ diag "Killing lttng-consumerd (pid: $PID_CONSUMERD)"
+ fi
+ kill $kill_opt $PID_CONSUMERD 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+ retval=$?
+ set +x
+
+ if [ $? -eq 1 ]; then
+ if [ $withtap -eq "1" ]; then
+ fail "Kill consumer daemon"
+ fi
+ return 1
+ else
+ out=1
+ while [ $out -ne 0 ]; do
+ pid=$(pidof $CONSUMERD_BIN)
+
+ # If consumerds are still present check their status.
+ # A zombie status qualifies the consumerd as *killed*
+ out=0
+ for consumer_pid in $pid; do
+ state=$(ps -p $consumer_pid -o state= )
+ if [[ -n "$state" && "$state" != "Z" ]]; then
+ out=1
+ fi
+ done
+ sleep 0.5
+ done
+ if [ $withtap -eq "1" ]; then
+ pass "Kill consumer daemon"
+ fi
+ fi
+ return $retval
+}
+
+function stop_lttng_consumerd()
+{
+ stop_lttng_consumerd_opt 1 "$@"
+}
+
+function stop_lttng_consumerd_notap()
+{
+ stop_lttng_consumerd_opt 0 "$@"
+}
+
function list_lttng_with_opts ()
{
local opts=$1
local expected_to_fail=$1
local sess_name=$2
local trace_path=$3
+ local opt=$4
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path > $OUTPUT_DEST
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path $opt > $OUTPUT_DEST
ret=$?
if [[ $expected_to_fail -eq "1" ]]; then
test "$ret" -ne "0"
local expect_fail=$1
local sess_name=$2
local channel_name=$3
+ local opt=$4
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -u $channel_name -s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -u $channel_name -s $sess_name $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
ret=$?
if [[ $expect_fail -eq "1" ]]; then
test "$ret" -ne "0"