X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=fe552830cf5d89b9e73e29e13f6e2e96b0d5a04c;hp=4b081a48ba365198b68a8873ae5964f0c1fb202c;hb=d53addeb964039ae2f544de1d7d452fb5ad6da69;hpb=eb82f91d0a44a7c51781d261a6b50d804246ff1e diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 4b081a48b..fe552830c 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -539,6 +539,26 @@ function trace_matches () fi } +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 +} + function validate_trace { local event_name=$1