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"
24 ERROR_OUTPUT_DEST
=/dev
/null
26 # Minimal kernel version supported for session daemon tests
27 KERNEL_MAJOR_VERSION
=2
28 KERNEL_MINOR_VERSION
=6
29 KERNEL_PATCHLEVEL_VERSION
=27
31 # We set the default UST register timeout to "wait forever", so that
32 # basic tests don't have to worry about hitting timeouts on busy
33 # systems. Specialized tests should test those corner-cases.
34 export LTTNG_UST_REGISTER_TIMEOUT
=-1
36 source $TESTDIR/utils
/tap
/tap.sh
40 # Check if we are a terminal
42 echo -e "\e[1;32mOK\e[0m"
48 function print_fail
()
50 # Check if we are a terminal
52 echo -e "\e[1;31mFAIL\e[0m"
58 function print_test_banner
()
64 function validate_kernel_version
()
66 local kern_version
=($
(uname
-r |
awk -F.
'{ printf("%d.%d.%d\n",$1,$2,$3); }' |
tr '.' '\n'))
67 if [ ${kern_version[0]} -gt $KERNEL_MAJOR_VERSION ]; then
70 if [ ${kern_version[1]} -gt $KERNEL_MINOR_VERSION ]; then
73 if [ ${kern_version[2]} -ge $KERNEL_PATCHLEVEL_VERSION ]; then
79 # Generate a random string
80 # $1 = number of characters; defaults to 16
81 # $2 = include special characters; 1 = yes, 0 = no; defaults to yes
84 [ "$2" == "0" ] && CHAR
="[:alnum:]" || CHAR
="[:graph:]"
85 cat /dev
/urandom |
tr -cd "$CHAR" |
head -c ${1:-16}
89 function lttng_enable_kernel_event
95 if [ -z $event_name ]; then
96 # Enable all event if no event name specified
100 if [ -z $channel_name ]; then
101 # default channel if none specified
104 chan
="-c $channel_name"
107 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" $chan -s $sess_name -k 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
108 ok $?
"Enable kernel event $event_name for session $sess_name"
111 function lttng_enable_kernel_syscall
()
113 local expected_to_fail
=$1
115 local syscall_name
=$3
116 local channel_name
=$4
118 if [ -z $syscall_name ]; then
119 # Enable all event if no syscall name specified
123 if [ -z $channel_name ]; then
124 # default channel if none specified
127 chan
="-c $channel_name"
130 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
--syscall "$syscall_name" $chan -s $sess_name -k 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
132 if [[ $expected_to_fail -eq "1" ]]; then
134 ok $?
"Enable kernel syscall $syscall_name for session $sess_name on channel $channel_name fail as expected"
136 ok
$ret "Enable kernel syscall $syscall_name for session $sess_name on channel $channel_name"
140 function lttng_enable_kernel_syscall_ok
()
142 lttng_enable_kernel_syscall
0 ${*}
145 function lttng_enable_kernel_syscall_fail
()
147 lttng_enable_kernel_syscall
1 ${*}
150 function lttng_disable_kernel_syscall
()
152 local expected_to_fail
=$1
154 local syscall_name
=$3
155 local channel_name
=$4
157 if [ -z $syscall_name ]; then
158 # Enable all event if no syscall name specified
162 if [ -z $channel_name ]; then
163 # default channel if none specified
166 chan
="-c $channel_name"
169 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
--syscall "$syscall_name" $chan -s $sess_name -k 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
172 if [[ $expected_to_fail -eq "1" ]]; then
174 ok $?
"Disable kernel syscall $syscall_name for session $sess_name on channel $channel_name fail as expected"
176 ok
$ret "Disable kernel syscall $syscall_name for session $sess_name on channel $channel_name"
180 function lttng_disable_kernel_syscall_ok
()
182 lttng_disable_kernel_syscall
0 ${*}
185 function lttng_disable_kernel_syscall_fail
()
187 lttng_disable_kernel_syscall
1 ${*}
190 function lttng_enable_kernel_channel
()
192 local expected_to_fail
=$1
194 local channel_name
=$3
196 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-k $channel_name -s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
198 if [[ $expected_to_fail -eq "1" ]]; then
200 ok $?
"Expected failure on kernel channel creation $channel_name in $sess_name"
202 ok
$ret "Enable channel $channel_name for session $sess_name"
206 function lttng_enable_kernel_channel_ok
()
208 lttng_enable_kernel_channel
0 ${*}
211 function lttng_enable_kernel_channel_fail
()
213 lttng_enable_kernel_channel
1 ${*}
216 function lttng_disable_kernel_channel
()
218 local expected_to_fail
=$1
220 local channel_name
=$3
222 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-channel
-k $channel_name -s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
224 if [[ $expected_to_fail -eq "1" ]]; then
226 ok $?
"Expected failure on kernel channel creation $channel_name in $sess_name"
228 ok
$ret "disable channel $channel_name for session $sess_name"
232 function lttng_disable_kernel_channel_ok
()
234 lttng_disable_kernel_channel
0 ${*}
237 function lttng_disable_kernel_channel_fail
()
239 lttng_disable_kernel_channel
1 ${*}
242 function start_lttng_relayd_opt
()
247 DIR
=$
(readlink
-f $TESTDIR)
249 if [ -z $
(pidof lt-
$RELAYD_BIN) ]; then
250 $DIR/..
/src
/bin
/lttng-relayd
/$RELAYD_BIN -b $opt 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
251 #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 &
252 if [ $?
-eq 1 ]; then
253 if [ $withtap -eq "1" ]; then
254 fail
"Start lttng-relayd (opt: $opt)"
258 if [ $withtap -eq "1" ]; then
259 pass
"Start lttng-relayd (opt: $opt)"
263 pass
"Start lttng-relayd (opt: $opt)"
267 function start_lttng_relayd
()
269 start_lttng_relayd_opt
1 "$@"
272 function start_lttng_relayd_notap
()
274 start_lttng_relayd_opt
0 "$@"
277 function stop_lttng_relayd_opt
()
281 PID_RELAYD
=`pidof lt-$RELAYD_BIN`
283 if [ $withtap -eq "1" ]; then
284 diag
"Killing lttng-relayd (pid: $PID_RELAYD)"
286 kill $PID_RELAYD 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
289 if [ $?
-eq 1 ]; then
290 if [ $withtap -eq "1" ]; then
291 fail
"Kill relay daemon"
296 while [ -n "$out" ]; do
297 out
=$
(pidof lt-
$RELAYD_BIN)
300 if [ $withtap -eq "1" ]; then
301 pass
"Kill relay daemon"
307 function stop_lttng_relayd
()
309 stop_lttng_relayd_opt
1 "$@"
312 function stop_lttng_relayd_notap
()
314 stop_lttng_relayd_opt
0 "$@"
317 #First arg: show tap output
318 #Second argument: load path for automatic loading
319 function start_lttng_sessiond_opt
()
324 if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then
325 # Env variable requested no session daemon
329 validate_kernel_version
330 if [ $?
-ne 0 ]; then
331 fail
"Start session daemon"
332 BAIL_OUT
"*** Kernel too old for session daemon tests ***"
335 DIR
=$
(readlink
-f $TESTDIR)
336 : ${LTTNG_SESSION_CONFIG_XSD_PATH=${DIR}/../src/common/config/}
337 export LTTNG_SESSION_CONFIG_XSD_PATH
339 if [ -z $
(pidof lt-
$SESSIOND_BIN) ]; then
341 if [ -n "$load_path" ]; then
342 $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"
344 $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"
346 #$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
348 if [ $withtap -eq "1" ]; then
349 ok
$status "Start session daemon"
354 function start_lttng_sessiond
()
356 start_lttng_sessiond_opt
1 "$@"
359 function start_lttng_sessiond_notap
()
361 start_lttng_sessiond_opt
0 "$@"
364 function stop_lttng_sessiond_opt
()
368 if [ -n $TEST_NO_SESSIOND ] && [ "$TEST_NO_SESSIOND" == "1" ]; then
369 # Env variable requested no session daemon
373 PID_SESSIOND
=`pidof lt-$SESSIOND_BIN`
375 kill $PID_SESSIOND 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
377 if [ $?
-eq 1 ]; then
378 if [ $withtap -eq "1" ]; then
379 fail
"Kill sessions daemon"
383 while [ -n "$out" ]; do
384 out
=$
(pidof lt-
$SESSIOND_BIN)
388 while [ -n "$out" ]; do
389 out
=$
(pidof
$CONSUMERD_BIN)
392 if [ $withtap -eq "1" ]; then
393 pass
"Kill session daemon"
398 function stop_lttng_sessiond
()
400 stop_lttng_sessiond_opt
1 "$@"
403 function stop_lttng_sessiond_notap
()
405 stop_lttng_sessiond_opt
0 "$@"
408 function list_lttng_with_opts
()
411 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN list
$opts 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
412 ok $?
"Lttng-tool list command with option $opts"
415 function create_lttng_session_no_output
()
419 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN create
$sess_name --no-output 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
420 ok $?
"Create session $sess_name in no-output mode"
423 function create_lttng_session
()
427 local expected_to_fail
=$3
429 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN create
$sess_name -o $trace_path > $OUTPUT_DEST
431 if [[ $expected_to_fail ]]; then
433 ok $?
"Expected fail on session creation $sess_name in $trace_path"
435 ok
$ret "Create session $sess_name in $trace_path"
439 function enable_ust_lttng_channel
()
442 local channel_name
=$2
445 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-u $channel_name -s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
447 if [[ $expect_fail ]]; then
449 ok $?
"Expected fail on ust channel creation $channel_name in $sess_name"
451 ok
$ret "Enable channel $channel_name for session $sess_name"
455 function disable_ust_lttng_channel
()
458 local channel_name
=$2
460 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-channel
-u $channel_name -s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
461 ok $?
"Disable channel $channel_name for session $sess_name"
464 function enable_lttng_mmap_overwrite_kernel_channel
()
467 local channel_name
=$2
469 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-s $sess_name $channel_name -k --output mmap
--overwrite 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
470 ok $?
"Enable channel $channel_name for session $sess_name"
473 function enable_lttng_mmap_overwrite_ust_channel
()
476 local channel_name
=$2
478 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-s $sess_name $channel_name -u --output mmap
--overwrite 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
479 ok $?
"Enable channel $channel_name for session $sess_name"
482 function enable_ust_lttng_event
()
485 local event_name
="$2"
486 local channel_name
=$3
487 local expected_to_fail
=$4
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 -u 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
498 if [[ $expected_to_fail ]]; then
500 ok $?
"Enable ust event $event_name for session $session_name on channel $channel_name failed as expected"
502 ok
$ret "Enable event $event_name for session $sess_name"
506 function enable_jul_lttng_event
()
512 if [ -z $channel_name ]; then
513 # default channel if none specified
516 chan
="-c $channel_name"
519 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" $chan -s $sess_name -j 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
520 ok $?
"Enable JUL event $event_name for session $sess_name"
523 function enable_jul_lttng_event_loglevel
()
526 local event_name
="$2"
528 local channel_name
=$4
530 if [ -z $channel_name ]; then
531 # default channel if none specified
534 chan
="-c $channel_name"
537 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
--loglevel $loglevel "$event_name" $chan -s $sess_name -j 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
538 ok $?
"Enable JUL event $event_name for session $sess_name with loglevel $loglevel"
541 function enable_log4j_lttng_event
()
547 if [ -z $channel_name ]; then
548 # default channel if none specified
551 chan
="-c $channel_name"
554 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" $chan -s $sess_name -l 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
555 ok $?
"Enable LOG4J event $event_name for session $sess_name"
558 function enable_log4j_lttng_event_loglevel
()
561 local event_name
="$2"
563 local channel_name
=$4
565 if [ -z $channel_name ]; then
566 # default channel if none specified
569 chan
="-c $channel_name"
572 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
--loglevel $loglevel "$event_name" $chan -s $sess_name -l 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
573 ok $?
"Enable LOG4J event $event_name for session $sess_name with loglevel $loglevel"
576 function enable_ust_lttng_event_filter
()
579 local event_name
="$2"
582 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" -s $sess_name -u --filter "$filter" 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
583 ok $?
"Enable event $event_name with filtering for session $sess_name"
586 function enable_ust_lttng_event_loglevel
()
589 local event_name
="$2"
592 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" -s $sess_name -u --loglevel $loglevel 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
593 ok $?
"Enable event $event_name with loglevel $loglevel"
596 function enable_ust_lttng_event_loglevel_only
()
599 local event_name
="$2"
602 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
"$event_name" -s $sess_name -u --loglevel-only $loglevel 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
603 ok $?
"Enable event $event_name with loglevel-only $loglevel"
606 function disable_ust_lttng_event
()
609 local event_name
="$2"
610 local channel_name
="$3"
612 if [ -z $channel_name ]; then
613 # default channel if none specified
616 chan
="-c $channel_name"
619 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
"$event_name" -s $sess_name $chan -u 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
620 ok $?
"Disable event $event_name for session $sess_name"
623 function disable_jul_lttng_event
()
626 local event_name
="$2"
628 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
"$event_name" -s $sess_name -j >/dev
/null
2>&1
629 ok $?
"Disable JUL event $event_name for session $sess_name"
632 function disable_log4j_lttng_event
()
635 local event_name
="$2"
637 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN disable-event
"$event_name" -s $sess_name -l >/dev
/null
2>&1
638 ok $?
"Disable LOG4J event $event_name for session $sess_name"
641 function start_lttng_tracing
()
644 local expected_to_fail
=$2
646 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN start
$sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
648 if [[ $expected_to_fail ]]; then
650 ok $?
"Expected fail on start tracing for session: $sess_name"
652 ok
$ret "Start tracing for session $sess_name"
656 function stop_lttng_tracing
()
659 local expected_to_fail
=$2
661 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN stop
$sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
663 if [[ $expected_to_fail ]]; then
665 ok $?
"Expected fail on stop tracing for session: $sess_name"
667 ok
$ret "Stop lttng tracing for session $sess_name"
671 function destroy_lttng_session
()
674 local expected_to_fail
=$2
676 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN destroy
$sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
678 if [[ $expected_to_fail ]]; then
680 ok $?
"Expected fail on session deletion $sess_name"
682 ok
$ret "Destroy session $sess_name"
686 function destroy_lttng_sessions
()
688 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN destroy
--all 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
689 ok $?
"Destroy all lttng sessions"
692 function lttng_snapshot_add_output
()
696 local expected_to_fail
=$3
698 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN snapshot add-output
-s $sess_name file://$trace_path 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
700 if [[ $expected_to_fail ]]; then
702 ok $?
"Failed to add a snapshot output file://$trace_path as expected"
704 ok
$ret "Added snapshot output file://$trace_path"
708 function lttng_snapshot_del_output
()
712 local expected_to_fail
=$3
714 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN snapshot del-output
-s $sess_name $id 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
716 if [[ $expected_to_fail ]]; then
718 ok $?
"Expect fail on deletion of snapshot output id $id"
720 ok
$ret "Deleted snapshot output id $id"
724 function lttng_snapshot_record
()
729 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN snapshot record
-s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
730 ok $?
"Snapshot recorded"
733 function lttng_snapshot_list
()
736 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN snapshot list-output
-s $sess_name 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
737 ok $?
"Snapshot list"
740 function lttng_save
()
745 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN save
$sess_name $opts 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
746 ok $?
"Session successfully saved"
749 function lttng_load
()
753 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN load
$opts 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
754 ok $?
"Load command successful"
757 function trace_matches
()
763 which $BABELTRACE_BIN >/dev
/null
764 skip $?
-ne 0 "Babeltrace binary not found. Skipping trace matches"
766 local count
=$
($BABELTRACE_BIN $trace_path |
grep $event_name |
wc -l)
768 if [ "$count" -ne "$nr_iter" ]; then
770 diag
"$count events found in trace"
776 function trace_match_only
()
782 which $BABELTRACE_BIN >/dev
/null
783 skip $?
-ne 0 "Babeltrace binary not found. Skipping trace matches"
785 local count
=$
($BABELTRACE_BIN $trace_path |
grep $event_name |
wc -l)
786 local total
=$
($BABELTRACE_BIN $trace_path |
wc -l)
788 if [ "$nr_iter" -eq "$count" ] && [ "$total" -eq "$nr_iter" ]; then
789 pass
"Trace match with $total event $event_name"
792 diag
"$total event(s) found, expecting $nr_iter of event $event_name and only found $count"
796 function validate_trace
801 which $BABELTRACE_BIN >/dev
/null
802 if [ $?
-ne 0 ]; then
803 skip
0 "Babeltrace binary not found. Skipping trace validation"
808 for i
in $event_name; do
809 traced
=$
($BABELTRACE_BIN $trace_path 2>/dev
/null |
grep $i |
wc -l)
810 if [ "$traced" -ne 0 ]; then
811 pass
"Validate trace for event $i, $traced events"
813 fail
"Validate trace for event $i"
814 diag
"Found $traced occurences of $i"
822 function validate_trace_exp
()
827 which $BABELTRACE_BIN >/dev
/null
828 skip $?
-ne 0 "Babeltrace binary not found. Skipping trace validation"
830 traced
=$
($BABELTRACE_BIN $trace_path 2>/dev
/null |
grep ${event_exp} |
wc -l)
831 if [ "$traced" -ne 0 ]; then
832 pass
"Validate trace for expression '${event_exp}', $traced events"
834 fail
"Validate trace for expression '${event_exp}'"
835 diag
"Found $traced occurences of '${event_exp}'"
841 function validate_trace_only_exp
()
846 which $BABELTRACE_BIN >/dev
/null
847 skip $?
-ne 0 "Babeltrace binary not found. Skipping trace matches"
849 local count
=$
($BABELTRACE_BIN $trace_path |
grep ${event_exp} |
wc -l)
850 local total
=$
($BABELTRACE_BIN $trace_path |
wc -l)
852 if [ "$count" -ne 0 ] && [ "$total" -eq "$count" ]; then
853 pass
"Trace match with $total for expression '${event_exp}"
856 diag
"$total syscall event(s) found, only syscalls matching expression '${event_exp}' ($count occurrences) are expected"
862 function validate_trace_empty
()
866 which $BABELTRACE_BIN >/dev
/null
867 if [ $?
-ne 0 ]; then
868 skip
0 "Babeltrace binary not found. Skipping trace validation"
871 traced
=$
($BABELTRACE_BIN $trace_path 2>/dev
/null |
wc -l)
872 if [ "$traced" -eq 0 ]; then
873 pass
"Validate empty trace"
875 fail
"Validate empty trace"
876 diag
"Found $traced events in trace"