X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=8cb664dd5c51a4c0bc116cbfa6c00eed2980a983;hb=6746f4f287d6322f02977977470ab737acdd27b4;hp=9df1c4fe283e1d4f682804d99948faeecd5cc7f6;hpb=5ddababf33c91d17423f0de9e35919664bb40608;p=lttng-tools.git diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 9df1c4fe2..8cb664dd5 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -472,3 +472,23 @@ function validate_trace 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 +}