3 # Copyright (C) - 2012 David Goulet <dgoulet@efficios.com>
5 # This library is free software; you can redistribute it and/or modify it under
6 # the terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation; version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
14 # You should have received a copy of the GNU Lesser General Public License
15 # along with this library; if not, write to the Free Software Foundation, Inc.,
16 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 SESSIOND_BIN
="lttng-sessiond"
19 CONSUMERD_BIN
="lttng-consumerd"
20 RELAYD_BIN
="lttng-relayd"
22 BABELTRACE_BIN
="babeltrace"
23 OUTPUT_DEST
=/dev
/null
2>&1
25 # Minimal kernel version supported for session daemon tests
26 KERNEL_MAJOR_VERSION
=2
27 KERNEL_MINOR_VERSION
=6
28 KERNEL_PATCHLEVEL_VERSION
=27
30 # We set the default UST register timeout to "wait forever", so that
31 # basic tests don't have to worry about hitting timeouts on busy
32 # systems. Specialized tests should test those corner-cases.
33 export LTTNG_UST_REGISTER_TIMEOUT
=-1
35 source $TESTDIR/utils
/tap
/tap.sh
39 # Check if we are a terminal
41 echo -e "\e[1;32mOK\e[0m"
47 function print_fail
()
49 # Check if we are a terminal
51 echo -e "\e[1;31mFAIL\e[0m"
57 function print_test_banner
()
63 function validate_kernel_version
()
65 local kern_version
=($
(uname
-r |
awk -F.
'{ printf("%d.%d.%d\n",$1,$2,$3); }' |
tr '.' '\n'))
66 if [ ${kern_version[0]} -gt $KERNEL_MAJOR_VERSION ]; then
69 if [ ${kern_version[1]} -gt $KERNEL_MINOR_VERSION ]; then
72 if [ ${kern_version[2]} -ge $KERNEL_PATCHLEVEL_VERSION ]; then
78 # Generate a random string
79 # $1 = number of characters; defaults to 16
80 # $2 = include special characters; 1 = yes, 0 = no; defaults to yes
83 [ "$2" == "0" ] && CHAR
="[:alnum:]" || CHAR
="[:graph:]"
84 cat /dev
/urandom |
tr -cd "$CHAR" |
head -c ${1:-16}
88 function lttng_enable_kernel_event
94 if [ -z $event_name ]; then
95 # Enable all event if no event name specified
99 if [ -z $channel_name ]; then
100 # default channel if none specified
103 chan
="-c $channel_name"
106 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" $chan -s $sess_name -k >$OUTPUT_DEST
107 ok $?
"Enable kernel event $event_name for session $sess_name"
110 function lttng_enable_kernel_syscall
()
112 local expected_to_fail
=$1
114 local syscall_name
=$3
115 local channel_name
=$4
117 if [ -z $syscall_name ]; then
118 # Enable all event if no syscall name specified
122 if [ -z $channel_name ]; then
123 # default channel if none specified
126 chan
="-c $channel_name"
129 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
--syscall "$syscall_name" $chan -s $sess_name -k >$OUTPUT_DEST
131 if [[ $expected_to_fail -eq "1" ]]; then
133 ok $?
"Enable kernel syscall $syscall_name for session $sess_name on channel $channel_name fail as expected"
135 ok
$ret "Enable kernel syscall $syscall_name for session $sess_name on channel $channel_name"
139 function lttng_enable_kernel_syscall_ok
()
141 lttng_enable_kernel_syscall
0 ${*}
144 function lttng_enable_kernel_syscall_fail
()
146 lttng_enable_kernel_syscall
1 ${*}
149 function lttng_disable_kernel_syscall
()
151 local expected_to_fail
=$1
153 local syscall_name
=$3
154 local channel_name
=$4
156 if [ -z $syscall_name ]; then
157 # Enable all event if no syscall name specified
161 if [ -z $channel_name ]; then
162 # default channel if none specified
165 chan
="-c $channel_name"
168 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
--syscall "$syscall_name" $chan -s $sess_name -k >$OUTPUT_DEST
171 if [[ $expected_to_fail -eq "1" ]]; then
173 ok $?
"Disable kernel syscall $syscall_name for session $sess_name on channel $channel_name fail as expected"
175 ok
$ret "Disable kernel syscall $syscall_name for session $sess_name on channel $channel_name"
179 function lttng_disable_kernel_syscall_ok
()
181 lttng_disable_kernel_syscall
0 ${*}
184 function lttng_disable_kernel_syscall_fail
()
186 lttng_disable_kernel_syscall
1 ${*}
189 function lttng_enable_kernel_channel
()
191 local expected_to_fail
=$1
193 local channel_name
=$3
195 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-k $channel_name -s $sess_name >$OUTPUT_DEST
197 if [[ $expected_to_fail -eq "1" ]]; then
199 ok $?
"Expected failure on kernel channel creation $channel_name in $sess_name"
201 ok
$ret "Enable channel $channel_name for session $sess_name"
205 function lttng_enable_kernel_channel_ok
()
207 lttng_enable_kernel_channel
0 ${*}
210 function lttng_enable_kernel_channel_fail
()
212 lttng_enable_kernel_channel
1 ${*}
215 function lttng_disable_kernel_channel
()
217 local expected_to_fail
=$1
219 local channel_name
=$3
221 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-channel
-k $channel_name -s $sess_name >$OUTPUT_DEST
223 if [[ $expected_to_fail -eq "1" ]]; then
225 ok $?
"Expected failure on kernel channel creation $channel_name in $sess_name"
227 ok
$ret "disable channel $channel_name for session $sess_name"
231 function lttng_disable_kernel_channel_ok
()
233 lttng_disable_kernel_channel
0 ${*}
236 function lttng_disable_kernel_channel_fail
()
238 lttng_disable_kernel_channel
1 ${*}
241 function start_lttng_relayd
245 DIR
=$
(readlink
-f $TESTDIR)
247 if [ -z $
(pidof lt-
$RELAYD_BIN) ]; then
248 $DIR/..
/src
/bin
/lttng-relayd
/$RELAYD_BIN -b $opt >$OUTPUT_DEST
249 #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 &
250 if [ $?
-eq 1 ]; then
251 fail
"Start lttng-relayd (opt: $opt)"
254 pass
"Start lttng-relayd (opt: $opt)"
257 pass
"Start lttng-relayd (opt: $opt)"
261 function stop_lttng_relayd_nocheck
263 PID_RELAYD
=`pidof lt-$RELAYD_BIN`
265 diag
"Killing lttng-relayd (pid: $PID_RELAYD)"
266 kill $PID_RELAYD >$OUTPUT_DEST
269 if [ $retval -eq 1 ]; then
271 while [ -n "$out" ]; do
272 out
=$
(pidof lt-
$RELAYD_BIN)
279 function stop_lttng_relayd
281 stop_lttng_relayd_nocheck
283 if [ $?
-eq 1 ]; then
284 fail
"Killed lttng-relayd (pid: $PID_RELAYD)"
287 pass
"Killed lttng-relayd (pid: $PID_RELAYD)"
292 #First argument: load path for automatic loading
293 function start_lttng_sessiond
()
297 if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then
298 # Env variable requested no session daemon
302 validate_kernel_version
303 if [ $?
-ne 0 ]; then
304 fail
"Start session daemon"
305 BAIL_OUT
"*** Kernel too old for session daemon tests ***"
308 DIR
=$
(readlink
-f $TESTDIR)
309 : ${LTTNG_SESSION_CONFIG_XSD_PATH=${DIR}/../src/common/config/}
310 export LTTNG_SESSION_CONFIG_XSD_PATH
312 if [ -z $
(pidof lt-
$SESSIOND_BIN) ]; then
315 $DIR/..
/src
/bin
/lttng-sessiond
/$SESSIOND_BIN --load "$1" --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
317 $DIR/..
/src
/bin
/lttng-sessiond
/$SESSIOND_BIN --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd"
319 #$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --verbose-consumer >>/tmp/sessiond.log 2>&1
321 ok
$status "Start session daemon"
325 function stop_lttng_sessiond
()
327 if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then
328 # Env variable requested no session daemon
332 PID_SESSIOND
=`pidof lt-$SESSIOND_BIN`
334 kill $PID_SESSIOND >$OUTPUT_DEST
336 if [ $?
-eq 1 ]; then
337 fail
"Kill sessions daemon"
341 while [ -n "$out" ]; do
342 out
=$
(pidof lt-
$SESSIOND_BIN)
346 while [ -n "$out" ]; do
347 out
=$
(pidof
$CONSUMERD_BIN)
350 pass
"Kill session daemon"
354 function list_lttng_with_opts
()
357 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN list
$opts >$OUTPUT_DEST
358 ok $?
"Lttng-tool list command with option $opts"
361 function create_lttng_session_no_output
()
365 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN create
$sess_name --no-output >$OUTPUT_DEST
366 ok $?
"Create session $sess_name in no-output mode"
369 function create_lttng_session
()
371 local expected_to_fail
=$1
375 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN create
$sess_name -o $trace_path > $OUTPUT_DEST
377 if [[ $expected_to_fail -eq "1" ]]; then
379 ok $?
"Expected fail on session creation $sess_name in $trace_path"
381 ok
$ret "Create session $sess_name in $trace_path"
385 function create_lttng_session_ok
()
387 create_lttng_session
0 "$@"
390 function create_lttng_session_fail
()
392 create_lttng_session
1 "$@"
396 function enable_ust_lttng_channel
()
400 local channel_name
=$3
402 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-u $channel_name -s $sess_name >$OUTPUT_DEST
404 if [[ $expect_fail -eq "1" ]]; then
406 ok $?
"Expected fail on ust channel creation $channel_name in $sess_name"
408 ok
$ret "Enable channel $channel_name for session $sess_name"
412 function enable_ust_lttng_channel_ok
()
414 enable_ust_lttng_channel
0 "$@"
417 function enable_ust_lttng_channel_fail
()
419 enable_ust_lttng_channel
1 "$@"
422 function disable_ust_lttng_channel
()
425 local channel_name
=$2
427 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-channel
-u $channel_name -s $sess_name >$OUTPUT_DEST
428 ok $?
"Disable channel $channel_name for session $sess_name"
431 function enable_lttng_mmap_overwrite_kernel_channel
()
434 local channel_name
=$2
436 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-s $sess_name $channel_name -k --output mmap
--overwrite >$OUTPUT_DEST
437 ok $?
"Enable channel $channel_name for session $sess_name"
440 function enable_lttng_mmap_overwrite_ust_channel
()
443 local channel_name
=$2
445 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-s $sess_name $channel_name -u --output mmap
--overwrite >$OUTPUT_DEST
446 ok $?
"Enable channel $channel_name for session $sess_name"
449 function enable_ust_lttng_event
()
451 local expected_to_fail
=$1
453 local event_name
="$3"
454 local channel_name
=$4
456 if [ -z $channel_name ]; then
457 # default channel if none specified
460 chan
="-c $channel_name"
463 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" $chan -s $sess_name -u >$OUTPUT_DEST
465 if [[ $expected_to_fail -eq "1" ]]; then
467 ok $?
"Enable ust event $event_name for session $session_name on channel $channel_name failed as expected"
469 ok
$ret "Enable event $event_name for session $sess_name"
473 function enable_ust_lttng_event_ok
()
475 enable_ust_lttng_event
0 "$@"
478 function enable_ust_lttng_event_fail
()
480 enable_ust_lttng_event
1 "$@"
483 function enable_jul_lttng_event
()
489 if [ -z $channel_name ]; then
490 # default channel if none specified
493 chan
="-c $channel_name"
496 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" $chan -s $sess_name -j >$OUTPUT_DEST
497 ok $?
"Enable JUL event $event_name for session $sess_name"
500 function enable_jul_lttng_event_loglevel
()
503 local event_name
="$2"
505 local channel_name
=$4
507 if [ -z $channel_name ]; then
508 # default channel if none specified
511 chan
="-c $channel_name"
514 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
--loglevel $loglevel "$event_name" $chan -s $sess_name -j >$OUTPUT_DEST
515 ok $?
"Enable JUL event $event_name for session $sess_name with loglevel $loglevel"
518 function enable_log4j_lttng_event
()
524 if [ -z $channel_name ]; then
525 # default channel if none specified
528 chan
="-c $channel_name"
531 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" $chan -s $sess_name -l >$OUTPUT_DEST
532 ok $?
"Enable LOG4J event $event_name for session $sess_name"
535 function enable_log4j_lttng_event_loglevel
()
538 local event_name
="$2"
540 local channel_name
=$4
542 if [ -z $channel_name ]; then
543 # default channel if none specified
546 chan
="-c $channel_name"
549 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
--loglevel $loglevel "$event_name" $chan -s $sess_name -l >$OUTPUT_DEST
550 ok $?
"Enable LOG4J event $event_name for session $sess_name with loglevel $loglevel"
553 function enable_python_lttng_event
()
559 if [ -z $channel_name ]; then
560 # default channel if none specified
563 chan
="-c $channel_name"
566 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" $chan -s $sess_name -p >$OUTPUT_DEST
567 ok $?
"Enable Python event $event_name for session $sess_name"
570 function enable_python_lttng_event_loglevel
()
573 local event_name
="$2"
575 local channel_name
=$4
577 if [ -z $channel_name ]; then
578 # default channel if none specified
581 chan
="-c $channel_name"
584 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
--loglevel $loglevel "$event_name" $chan -s $sess_name -p >$OUTPUT_DEST
585 ok $?
"Enable Python event $event_name for session $sess_name with loglevel $loglevel"
588 function enable_ust_lttng_event_filter
()
591 local event_name
="$2"
594 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" -s $sess_name -u --filter "$filter" >$OUTPUT_DEST
595 ok $?
"Enable event $event_name with filtering for session $sess_name"
598 function enable_ust_lttng_event_loglevel
()
601 local event_name
="$2"
604 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" -s $sess_name -u --loglevel $loglevel >$OUTPUT_DEST
605 ok $?
"Enable event $event_name with loglevel $loglevel"
608 function enable_ust_lttng_event_loglevel_only
()
611 local event_name
="$2"
614 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" -s $sess_name -u --loglevel-only $loglevel >$OUTPUT_DEST
615 ok $?
"Enable event $event_name with loglevel-only $loglevel"
618 function disable_ust_lttng_event
()
621 local event_name
="$2"
622 local channel_name
="$3"
624 if [ -z $channel_name ]; then
625 # default channel if none specified
628 chan
="-c $channel_name"
631 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
"$event_name" -s $sess_name $chan -u >$OUTPUT_DEST
632 ok $?
"Disable event $event_name for session $sess_name"
635 function disable_jul_lttng_event
()
638 local event_name
="$2"
640 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
"$event_name" -s $sess_name -j >/dev
/null
2>&1
641 ok $?
"Disable JUL event $event_name for session $sess_name"
644 function disable_log4j_lttng_event
()
647 local event_name
="$2"
649 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
"$event_name" -s $sess_name -l >/dev
/null
2>&1
650 ok $?
"Disable LOG4J event $event_name for session $sess_name"
653 function disable_python_lttng_event
()
656 local event_name
="$2"
658 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
"$event_name" -s $sess_name -p >$OUTPUT_DEST
659 ok $?
"Disable Python event $event_name for session $sess_name"
662 function start_lttng_tracing
()
664 local expected_to_fail
=$1
667 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN start
$sess_name >$OUTPUT_DEST
669 if [[ $expected_to_fail -eq "1" ]]; then
671 ok $?
"Expected fail on start tracing for session: $sess_name"
673 ok
$ret "Start tracing for session $sess_name"
677 function start_lttng_tracing_ok
()
679 start_lttng_tracing
0 "$@"
682 function start_lttng_tracing_fail
()
684 start_lttng_tracing
1 "$@"
687 function stop_lttng_tracing
()
689 local expected_to_fail
=$1
692 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN stop
$sess_name >$OUTPUT_DEST
694 if [[ $expected_to_fail -eq "1" ]]; then
696 ok $?
"Expected fail on stop tracing for session: $sess_name"
698 ok
$ret "Stop lttng tracing for session $sess_name"
702 function stop_lttng_tracing_ok
()
704 stop_lttng_tracing
0 "$@"
707 function stop_lttng_tracing_fail
()
709 stop_lttng_tracing
1 "$@"
712 function destroy_lttng_session
()
714 local expected_to_fail
=$1
717 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN destroy
$sess_name >$OUTPUT_DEST
719 if [[ $expected_to_fail -eq "1" ]]; then
721 ok $?
"Expected fail on session deletion $sess_name"
723 ok
$ret "Destroy session $sess_name"
727 function destroy_lttng_session_ok
()
729 destroy_lttng_session
0 "$@"
733 function destroy_lttng_session_fail
()
735 destroy_lttng_session
1 "$@"
739 function destroy_lttng_sessions
()
741 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN destroy
--all >$OUTPUT_DEST
742 ok $?
"Destroy all lttng sessions"
745 function lttng_snapshot_add_output
()
749 local expected_to_fail
=$3
751 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN snapshot add-output
-s $sess_name file://$trace_path >$OUTPUT_DEST
753 if [[ $expected_to_fail ]]; then
755 ok $?
"Failed to add a snapshot output file://$trace_path as expected"
757 ok
$ret "Added snapshot output file://$trace_path"
761 function lttng_snapshot_del_output
()
765 local expected_to_fail
=$3
767 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN snapshot del-output
-s $sess_name $id >$OUTPUT_DEST
769 if [[ $expected_to_fail ]]; then
771 ok $?
"Expect fail on deletion of snapshot output id $id"
773 ok
$ret "Deleted snapshot output id $id"
777 function lttng_snapshot_record
()
782 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN snapshot record
-s $sess_name >$OUTPUT_DEST
783 ok $?
"Snapshot recorded"
786 function lttng_snapshot_list
()
789 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN snapshot list-output
-s $sess_name >$OUTPUT_DEST
790 ok $?
"Snapshot list"
793 function lttng_save
()
798 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN save
$sess_name $opts >$OUTPUT_DEST
799 ok $?
"Session successfully saved"
802 function lttng_load
()
806 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN load
$opts >$OUTPUT_DEST
807 ok $?
"Load command successful"
810 function trace_matches
()
816 which $BABELTRACE_BIN >/dev
/null
817 skip $?
-ne 0 "Babeltrace binary not found. Skipping trace matches"
819 local count
=$
($BABELTRACE_BIN $trace_path |
grep $event_name |
wc -l)
821 if [ "$count" -ne "$nr_iter" ]; then
823 diag
"$count events found in trace"
829 function trace_match_only
()
835 which $BABELTRACE_BIN >/dev
/null
836 skip $?
-ne 0 "Babeltrace binary not found. Skipping trace matches"
838 local count
=$
($BABELTRACE_BIN $trace_path |
grep $event_name |
wc -l)
839 local total
=$
($BABELTRACE_BIN $trace_path |
wc -l)
841 if [ "$nr_iter" -eq "$count" ] && [ "$total" -eq "$nr_iter" ]; then
842 pass
"Trace match with $total event $event_name"
845 diag
"$total event(s) found, expecting $nr_iter of event $event_name and only found $count"
849 function validate_trace
854 which $BABELTRACE_BIN >/dev
/null
855 if [ $?
-ne 0 ]; then
856 skip
0 "Babeltrace binary not found. Skipping trace validation"
861 for i
in $event_name; do
862 traced
=$
($BABELTRACE_BIN $trace_path 2>/dev
/null |
grep $i |
wc -l)
863 if [ "$traced" -ne 0 ]; then
864 pass
"Validate trace for event $i, $traced events"
866 fail
"Validate trace for event $i"
867 diag
"Found $traced occurences of $i"
875 function validate_trace_exp
()
880 which $BABELTRACE_BIN >/dev
/null
881 skip $?
-ne 0 "Babeltrace binary not found. Skipping trace validation"
883 traced
=$
($BABELTRACE_BIN $trace_path 2>/dev
/null |
grep ${event_exp} |
wc -l)
884 if [ "$traced" -ne 0 ]; then
885 pass
"Validate trace for expression '${event_exp}', $traced events"
887 fail
"Validate trace for expression '${event_exp}'"
888 diag
"Found $traced occurences of '${event_exp}'"
894 function validate_trace_only_exp
()
899 which $BABELTRACE_BIN >/dev
/null
900 skip $?
-ne 0 "Babeltrace binary not found. Skipping trace matches"
902 local count
=$
($BABELTRACE_BIN $trace_path |
grep ${event_exp} |
wc -l)
903 local total
=$
($BABELTRACE_BIN $trace_path |
wc -l)
905 if [ "$count" -ne 0 ] && [ "$total" -eq "$count" ]; then
906 pass
"Trace match with $total for expression '${event_exp}"
909 diag
"$total syscall event(s) found, only syscalls matching expression '${event_exp}' ($count occurrences) are expected"
915 function validate_trace_empty
()
919 which $BABELTRACE_BIN >/dev
/null
920 if [ $?
-ne 0 ]; then
921 skip
0 "Babeltrace binary not found. Skipping trace validation"
924 traced
=$
($BABELTRACE_BIN $trace_path 2>/dev
/null |
wc -l)
925 if [ "$traced" -eq 0 ]; then
926 pass
"Validate empty trace"
928 fail
"Validate empty trace"
929 diag
"Found $traced events in trace"