Test: change use of space for tabs in utils.sh
[lttng-tools.git] / tests / utils / utils.sh
index 7704e5246e75d5ff52ed65885118ec18dfd12cbf..2d53a7237350e6df4b5492ab2930c0d2f6f391a9 100644 (file)
@@ -1382,6 +1382,29 @@ function add_context_kernel_fail()
        add_context_lttng 1 -k "$@"
 }
 
+function validate_metadata_event ()
+{
+       local event_name=$1
+       local nr_event_id=$2
+       local trace_path=$3
+
+       local metadata_file=$(find $trace_path | grep metadata)
+       local metadata_path=$(dirname $metadata_file)
+
+       which $BABELTRACE_BIN >/dev/null
+       skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+
+       local count=$($BABELTRACE_BIN --output-format=ctf-metadata $metadata_path | grep $event_name | wc -l)
+
+       if [ "$count" -ne "$nr_event_id" ]; then
+               fail "Metadata match with the metadata of $count event(s) named $event_name"
+               diag "$count matching event id found in metadata"
+       else
+               pass "Metadata match with the metadata of $count event(s) named $event_name"
+       fi
+
+}
+
 function trace_matches ()
 {
        local event_name=$1
@@ -1413,12 +1436,12 @@ function trace_match_only()
        local count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l)
        local total=$($BABELTRACE_BIN $trace_path | wc -l)
 
-    if [ "$nr_iter" -eq "$count" ] && [ "$total" -eq "$nr_iter" ]; then
-        pass "Trace match with $total event $event_name"
-    else
-        fail "Trace match"
-        diag "$total event(s) found, expecting $nr_iter of event $event_name and only found $count"
-    fi
+       if [ "$nr_iter" -eq "$count" ] && [ "$total" -eq "$nr_iter" ]; then
+               pass "Trace match with $total event $event_name"
+       else
+               fail "Trace match"
+               diag "$total event(s) found, expecting $nr_iter of event $event_name and only found $count"
+       fi
 }
 
 function validate_trace
This page took 0.027242 seconds and 5 git commands to generate.