3 # Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
5 # SPDX-License-Identifier: GPL-2.0-only
8 TEST_DESC
="Event exclusion"
11 TESTDIR
=$CURDIR/..
/..
/..
12 STATS_BIN
="$TESTDIR/utils/babelstats.pl"
13 SESSION_NAME
="test-exclusion"
14 TESTAPP_PATH
="$TESTDIR/utils/testapp"
15 TESTAPP_NAME
="gen-ust-nevents"
16 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
21 source $TESTDIR/utils
/utils.sh
23 function enable_ust_lttng_all_event_exclusion
()
28 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
-a -s $sess_name -u -x "$exclusion"
33 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev
/null
2>&1
36 function test_exclusion
39 event_name_expected_to_be_missing
="$2"
40 trace_path
=$
(mktemp
-d)
43 create_lttng_session_ok
$SESSION_NAME $trace_path
45 enable_ust_lttng_all_event_exclusion
$SESSION_NAME "$exclusions"
46 ok $?
"Enable lttng event with event \"$exclusions\" excluded"
49 start_lttng_tracing_ok
$SESSION_NAME
51 stop_lttng_tracing_ok
$SESSION_NAME
54 destroy_lttng_session_ok
$SESSION_NAME
56 stats
=`babeltrace $trace_path | $STATS_BIN --tracepoint "$event_name_expected_to_be_missing" | grep -v index`
57 if [ ! -z "$stats" ]; then
58 fail
"Excluded event \"$event_name_expected_to_be_missing\" was found in trace!"
60 ok
0 "Validate trace exclusion output"
65 function test_exclusion_fail
70 create_lttng_session_ok
$SESSION_NAME $trace_path
71 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-event
-u "$event_name" -s $sess_name -x "$exclusions" >/dev
/null
2>&1
73 destroy_lttng_session_ok
$SESSION_NAME
75 if [ $res -eq 0 ]; then
76 fail
"Enable LTTng event \"$event_name\" with exclusion \"$exclusions\" passes"
79 pass
"Enable LTTng event \"$event_name\" with exclusion \"$exclusions\" fails"
86 print_test_banner
$TEST_DESC
90 test_exclusion
'tp:tptest2' 'tp:tptest2'
91 test_exclusion
'tp:tptest3' 'tp:tptest3'
92 test_exclusion
'tp:tptest*' 'tp:tptest1'
93 test_exclusion
'tp:tptest*' 'tp:tptest2'
94 test_exclusion
'tp:tptest*' 'tp:tptest3'
95 test_exclusion
'tp:tptest*' 'tp:tptest4'
96 test_exclusion
'tp:tptest*' 'tp:tptest5'
97 test_exclusion
'tp*tptest*' 'tp:tptest1'
98 test_exclusion
'tp*tptest*' 'tp:tptest2'
99 test_exclusion
'tp*tptest*' 'tp:tptest3'
100 test_exclusion
'tp*tptest*' 'tp:tptest4'
101 test_exclusion
'tp*tptest*' 'tp:tptest5'
102 test_exclusion
'*test2' 'tp:tptest2'
103 test_exclusion
'*test5' 'tp:tptest5'
104 test_exclusion
'*p*test*' 'tp:tptest1'
105 test_exclusion
'*p*test*' 'tp:tptest2'
106 test_exclusion
'*p*test*' 'tp:tptest3'
107 test_exclusion
'*p***test*' 'tp:tptest4'
108 test_exclusion
'*p*test*' 'tp:tptest5'
109 test_exclusion
'*3' 'tp:tptest3'
110 test_exclusion
'tp*test3,*2' 'tp:tptest2'
111 test_exclusion
'**tp*test3,*2' 'tp:tptest3'
113 # Cannot use exclusions with non-globbing event name
114 test_exclusion_fail
"allo" "lol"
115 test_exclusion_fail
"allo" "meow,lol"
116 test_exclusion_fail
"allo" "z*em"
118 # Exclusion name excludes all possible event names
119 test_exclusion_fail
"allo*" "all*"
120 test_exclusion_fail
"allo*" "ze,all*,yes"