Backport: create_lttng_session_uri from 308a89467c4dbfe218a9665bab82555dd88c07c9
[lttng-tools.git] / tests / utils / utils.sh
index e8dfcda3cedf157c334d594bbc187d42020c4864..e7147c36636e6c20ce8bdf292404c70834c84da2 100644 (file)
@@ -601,9 +601,9 @@ function stop_lttng_consumerd_opt()
        if [ $withtap -eq "1" ]; then
                diag "Killing $CONSUMERD_BIN pids: $(echo $PID_CONSUMERD | tr '\n' ' ')"
        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
@@ -658,7 +658,6 @@ function sigstop_lttng_consumerd_opt()
        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
@@ -713,6 +712,15 @@ function create_lttng_session_no_output ()
        ok $? "Create session $sess_name in no-output mode"
 }
 
+function create_lttng_session_uri () {
+    local sess_name=$1
+    local uri=$2
+    local opts="${@:3}"
+
+    $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -U $uri $opts 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+    ok $? "Create session $sess_name with uri:$uri and opts: $opts"
+}
+
 function create_lttng_session ()
 {
        local withtap=$1
@@ -1498,7 +1506,14 @@ function validate_trace_empty()
            skip 0 "Babeltrace binary not found. Skipping trace validation"
        fi
 
-       traced=$($BABELTRACE_BIN $trace_path 2>/dev/null | wc -l)
+       events=$($BABELTRACE_BIN $trace_path 2>/dev/null)
+       ret=$?
+       if [ $ret -ne 0 ]; then
+               fail "Failed to parse trace"
+               return $ret
+       fi
+
+       traced=$(echo -n "$events" | wc -l)
        if [ "$traced" -eq 0 ]; then
                pass "Validate empty trace"
        else
This page took 0.026642 seconds and 5 git commands to generate.