Fix validate_trace_empty test check
[lttng-tools.git] / tests / utils / utils.sh
index e8dfcda3cedf157c334d594bbc187d42020c4864..9980e8538a124006a035403ef423fbe9c9c453ae 100644 (file)
@@ -1305,6 +1305,19 @@ function lttng_untrack_fail()
        lttng_untrack 1 "$@"
 }
 
+function lttng_track_pid_ok()
+{
+       PID=$1
+       "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" track --kernel --pid=$PID 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+       ok $? "Lttng track pid on the kernel domain"
+}
+
+function lttng_untrack_kernel_all_ok()
+{
+       "$TESTDIR/../src/bin/lttng/$LTTNG_BIN" untrack --kernel --pid --all 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+       ok $? "Lttng untrack all pid on the kernel domain"
+}
+
 function add_context_lttng()
 {
        local expected_to_fail="$1"
@@ -1498,7 +1511,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.024583 seconds and 4 git commands to generate.