return 1
}
-function start_sessiond ()
+function spawn_sessiond ()
{
echo ""
echo -n "Starting session daemon... "
return 2
fi
+ DIR=$(readlink -f $TESTDIR)
+
if [ -z $(pidof lt-$SESSIOND_BIN) ]; then
- $TESTDIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --quiet --consumerd32-path="$(pwd)/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$(pwd)/../src/bin/lttng-consumerd/lttng-consumerd"
+ $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --quiet --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
if [ $? -eq 1 ]; then
echo -e "\e[1;31mFAILED\e[0m"
return 1
return 0
}
+function start_sessiond()
+{
+ if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then
+ # Env variable requested no session daemon
+ return
+ fi
+
+ spawn_sessiond
+ out=$?
+ if [ $out -eq 2 ]; then
+ # Kernel version is not compatible.
+ exit 0
+ elif [ $out -ne 0 ]; then
+ echo "NOT bad $?"
+ exit 1
+ fi
+
+ # Simply wait for the session daemon bootstrap
+ echo "Waiting for the session daemon to bootstrap (2 secs)"
+ sleep 2
+}
+
function stop_sessiond ()
{
+ if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then
+ # Env variable requested no session daemon
+ return
+ fi
+
PID_SESSIOND=`pidof lt-$SESSIOND_BIN`
echo -e -n "Killing session daemon... "
echo -e "\e[1;31mFAILED\e[0m"
return 1
else
+ out=1
+ while [ -n "$out" ]; do
+ out=$(pidof lt-$SESSIOND_BIN)
+ sleep 0.5
+ done
echo -e "\e[1;32mOK\e[0m"
fi
}
sess_name=$1
trace_path=$2
- echo -n "Creating lttng session $SESSION_NAME in $TRACE_PATH "
+ echo -n "Creating lttng session $sess_name in $trace_path "
$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path >/dev/null 2>&1
if [ $? -eq 1 ]; then
echo -e "\e[1;31mFAILED\e[0m"
return 1
else
echo -e "\e[1;32mOK\e[0m"
- #echo $out | grep "written in" | cut -d' ' -f6
+ fi
+}
+
+function enable_lttng_channel()
+{
+ sess_name=$1
+ channel_name=$2
+
+ echo -n "Enabling lttng channel $channel_name for session $sess_name"
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel $channel_name -s $sess_name >/dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo -e "\e[1;31mFAILED\e[0m"
+ return 1
+ else
+ echo -e "\e[1;32mOK\e[0m"
+ fi
+}
+
+function disable_lttng_channel()
+{
+ sess_name=$1
+ channel_name=$2
+
+ echo -n "Disabling lttng channel $channel_name for session $sess_name"
+ $TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-channel $channel_name -s $sess_name >/dev/null 2>&1
+ if [ $? -eq 1 ]; then
+ echo -e "\e[1;31mFAILED\e[0m"
+ return 1
+ else
+ echo -e "\e[1;32mOK\e[0m"
fi
}