RELAYD_BIN="lttng-relayd"
LTTNG_BIN="lttng"
BABELTRACE_BIN="babeltrace"
+OUTPUT_DEST=/dev/null 2>&1
# Minimal kernel version supported for session daemon tests
KERNEL_MAJOR_VERSION=2
chan="-c $channel_name"
fi
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -k >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -k >$OUTPUT_DEST
ok $? "Enable kernel event $event_name for session $sess_name"
}
DIR=$(readlink -f $TESTDIR)
if [ -z $(pidof lt-$RELAYD_BIN) ]; then
- $DIR/../src/bin/lttng-relayd/$RELAYD_BIN -b $opt >/dev/null 2>&1
+ $DIR/../src/bin/lttng-relayd/$RELAYD_BIN -b $opt >$OUTPUT_DEST
#$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 &
if [ $? -eq 1 ]; then
fail "Start lttng-relayd (opt: $opt)"
PID_RELAYD=`pidof lt-$RELAYD_BIN`
diag "Killing lttng-relayd (pid: $PID_RELAYD)"
- kill $PID_RELAYD >/dev/null 2>&1
+ kill $PID_RELAYD >$OUTPUT_DEST
retval=$?
if [ $retval -eq 1 ]; then
PID_SESSIOND=`pidof lt-$SESSIOND_BIN`
- kill $PID_SESSIOND >/dev/null 2>&1
+ kill $PID_SESSIOND >$OUTPUT_DEST
if [ $? -eq 1 ]; then
fail "Kill sessions daemon"
fi
}
+function list_lttng_with_opts ()
+{
+ opts=$1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN $opts >$OUTPUT_DEST
+ ok $? "Lttng-tool list command with option $opts"
+}
+
function create_lttng_session_no_output ()
{
sess_name=$1
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name --no-output >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name --no-output >$OUTPUT_DEST
ok $? "Create session $sess_name in no-output mode"
}
{
sess_name=$1
trace_path=$2
+ expected_to_fail=$3
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path >/dev/null 2>&1
- ok $? "Create session $sess_name in $trace_path"
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path > $OUTPUT_DEST
+ ret=$?
+ if [[ $expected_to_fail && $ret ]]; then
+ ok 0 "Expected fail on session creation $sess_name in $trace_path"
+ else
+ ok $ret "Create session $sess_name in $trace_path"
+ fi
}
function enable_ust_lttng_channel()
sess_name=$1
channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -u $channel_name -s $sess_name >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -u $channel_name -s $sess_name >$OUTPUT_DEST
ok $? "Enable channel $channel_name for session $sess_name"
}
sess_name=$1
channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-channel -u $channel_name -s $sess_name >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-channel -u $channel_name -s $sess_name >$OUTPUT_DEST
ok $? "Disable channel $channel_name for session $sess_name"
}
sess_name=$1
channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name $channel_name -k --output mmap --overwrite >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name $channel_name -k --output mmap --overwrite >$OUTPUT_DEST
ok $? "Enable channel $channel_name for session $sess_name"
}
sess_name=$1
channel_name=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name $channel_name -u --output mmap --overwrite >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name $channel_name -u --output mmap --overwrite >$OUTPUT_DEST
ok $? "Enable channel $channel_name for session $sess_name"
}
chan="-c $channel_name"
fi
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -u >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -u >$OUTPUT_DEST
ok $? "Enable event $event_name for session $sess_name"
}
chan="-c $channel_name"
fi
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -j >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" $chan -s $sess_name -j >$OUTPUT_DEST
ok $? "Enable JUL event $event_name for session $sess_name"
}
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
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event --loglevel $loglevel "$event_name" $chan -s $sess_name -j >$OUTPUT_DEST
ok $? "Enable JUL event $event_name for session $sess_name with loglevel $loglevel"
}
event_name="$2"
filter="$3"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" -s $sess_name -u --filter "$filter" >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" -s $sess_name -u --filter "$filter" >$OUTPUT_DEST
ok $? "Enable event $event_name with filtering for session $sess_name"
}
event_name="$2"
loglevel="$3"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" -s $sess_name -u --loglevel $loglevel >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" -s $sess_name -u --loglevel $loglevel >$OUTPUT_DEST
ok $? "Enable event $event_name with loglevel $loglevel"
}
event_name="$2"
loglevel="$3"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" -s $sess_name -u --loglevel-only $loglevel >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" -s $sess_name -u --loglevel-only $loglevel >$OUTPUT_DEST
ok $? "Enable event $event_name with loglevel-only $loglevel"
}
sess_name="$1"
event_name="$2"
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-event "$event_name" -s $sess_name -u >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-event "$event_name" -s $sess_name -u >$OUTPUT_DEST
ok $? "Disable event $event_name for session $sess_name"
}
{
sess_name=$1
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $sess_name >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $sess_name >$OUTPUT_DEST
ok $? "Start tracing for session $sess_name"
}
{
sess_name=$1
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $sess_name >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $sess_name >$OUTPUT_DEST
ok $? "Stop lttng tracing for session $sess_name"
}
{
sess_name=$1
-
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $sess_name >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $sess_name >$OUTPUT_DEST
ok $? "Destroy lttng session $sess_name"
}
+function destroy_lttng_sessions ()
+{
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy --all >$OUTPUT_DEST
+ ok $? "Destroy all lttng sessions"
+}
+
function lttng_snapshot_add_output ()
{
sess_name=$1
trace_path=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output -s $sess_name file://$trace_path >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot add-output -s $sess_name file://$trace_path >$OUTPUT_DEST
ok $? "Added snapshot output file://$trace_path"
}
local sess_name=$1
local id=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot del-output -s $sess_name $id >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot del-output -s $sess_name $id >$OUTPUT_DEST
ok $? "Deleted snapshot output id $id"
}
sess_name=$1
trace_path=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot record -s $sess_name >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN snapshot record -s $sess_name >$OUTPUT_DEST
ok $? "Snapshot recorded"
}
local sess_name=$1
local opts=$2
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN save $sess_name $opts >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN save $sess_name $opts >$OUTPUT_DEST
ok $? "Session successfully saved"
}
{
local opts=$1
- $TESTDIR/../src/bin/lttng/$LTTNG_BIN load $opts >/dev/null 2>&1
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN load $opts >$OUTPUT_DEST
ok $? "Load command successful"
}