destroy_lttng_session $SESSION_NAME-2
# Validate test. Expecting one event of the second TP.
- trace_matches $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-1
+ trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-1
if [ $? -ne 0 ]; then
return $?
fi
# Validate test. Expecting one event of the second TP.
- trace_matches $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-2
+ trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME-2
if [ $? -ne 0 ]; then
return $?
fi
destroy_lttng_session $SESSION_NAME
# Validate test. Expecting one event of the second TP only.
- trace_matches $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME
+ trace_match_only $EVENT_NAME2 1 $TRACE_PATH/$SESSION_NAME
if [ $? -ne 0 ]; then
return $?
fi
destroy_lttng_session $SESSION_NAME
# Validate test. Expecting NR_ITER event of the main INFO tp.
- trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH/$SESSION_NAME
+ trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH/$SESSION_NAME
if [ $? -ne 0 ]; then
return $?
fi
IFS=$OLDIFS
return $ret
}
+
+function trace_match_only()
+{
+ local event_name=$1
+ local nr_iter=$2
+ local trace_path=$3
+
+ which $BABELTRACE_BIN >/dev/null
+ skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+
+ 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
+}