Test: clear: local, streaming, live, tracefile rotation
[lttng-tools.git] / tests / utils / utils.sh
index affed61660043afea481324cd2bad93d392af259..a63efdf63c3638b07bab0f3642b86b98de5786b3 100644 (file)
@@ -343,11 +343,17 @@ function start_lttng_relayd_opt()
 {
        local withtap=$1
        local opt=$2
+       local env_vars=""
 
        DIR=$(readlink -f $TESTDIR)
 
+       # Check for env. variable. Allow the use of LD_PRELOAD etc.
+       if [[ "x${LTTNG_RELAYD_ENV_VARS}" != "x" ]]; then
+               env_vars=${LTTNG_RELAYD_ENV_VARS}
+       fi
+
        if [ -z $(pgrep $RELAYD_MATCH) ]; then
-               $DIR/../src/bin/lttng-relayd/$RELAYD_BIN -b $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+               env $env_vars $DIR/../src/bin/lttng-relayd/$RELAYD_BIN -b $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
                #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 &
                if [ $? -eq 1 ]; then
                        if [ $withtap -eq "1" ]; then
@@ -1082,52 +1088,68 @@ function disable_python_lttng_event ()
 
 function start_lttng_tracing ()
 {
-       local expected_to_fail=$1
-       local sess_name=$2
+       local withtap=$1
+       local expected_to_fail=$2
+       local sess_name=$3
 
        $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
        ret=$?
-       if [[ $expected_to_fail -eq "1" ]]; then
-               test "$ret" -ne "0"
-               ok $? "Start tracing for session $sess_name failed as expected"
-       else
-               ok $ret "Start tracing for session $sess_name"
+       if [ $withtap -eq "1" ]; then
+               if [[ $expected_to_fail -eq "1" ]]; then
+                       test "$ret" -ne "0"
+                       ok $? "Start tracing for session $sess_name failed as expected"
+               else
+                       ok $ret "Start tracing for session $sess_name"
+               fi
        fi
 }
 
 function start_lttng_tracing_ok ()
 {
-       start_lttng_tracing 0 "$@"
+       start_lttng_tracing 0 "$@"
 }
 
 function start_lttng_tracing_fail ()
 {
-       start_lttng_tracing 1 "$@"
+       start_lttng_tracing 1 1 "$@"
+}
+
+function start_lttng_tracing_notap ()
+{
+       start_lttng_tracing 0 0 "$@"
 }
 
 function stop_lttng_tracing ()
 {
-       local expected_to_fail=$1
-       local sess_name=$2
+       local withtap=$1
+       local expected_to_fail=$2
+       local sess_name=$3
 
        $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
        ret=$?
-       if [[ $expected_to_fail -eq "1" ]]; then
-               test "$ret" -ne "0"
-               ok $? "Stop lttng tracing for session $sess_name failed as expected"
-       else
-               ok $ret "Stop lttng tracing for session $sess_name"
+       if [ $withtap -eq "1" ]; then
+               if [[ $expected_to_fail -eq "1" ]]; then
+                       test "$ret" -ne "0"
+                       ok $? "Stop lttng tracing for session $sess_name failed as expected"
+               else
+                       ok $ret "Stop lttng tracing for session $sess_name"
+               fi
        fi
 }
 
 function stop_lttng_tracing_ok ()
 {
-       stop_lttng_tracing 0 "$@"
+       stop_lttng_tracing 0 "$@"
 }
 
 function stop_lttng_tracing_fail ()
 {
-       stop_lttng_tracing 1 "$@"
+       stop_lttng_tracing 1 1 "$@"
+}
+
+function stop_lttng_tracing_notap ()
+{
+       stop_lttng_tracing 0 0 "$@"
 }
 
 function destroy_lttng_session ()
This page took 0.02656 seconds and 5 git commands to generate.