3 # Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com>
4 # Copyright (C) 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 # SPDX-License-Identifier: GPL-2.0-only
8 TEST_DESC
="LTTng - Event wildcard test"
11 TESTDIR
=$CURDIR/..
/..
/..
12 TESTAPP_PATH
="$TESTDIR/utils/testapp"
13 TESTAPP_NAME
="gen-ust-events"
14 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
15 SESSION_NAME
="wildcard"
18 NUM_UST_TESTS
=$
(( 7 * 25 ))
19 NUM_KERNEL_TESTS
=$
(( 7 * 25 ))
20 NUM_TESTS
=$
(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
22 source $TESTDIR/utils
/utils.sh
26 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT
31 # Trigger the event for 100 iterations
32 echo -n "100" > /proc
/lttng-test-filter-event
35 function test_event_wildcard
()
37 TRACE_PATH
=$
(mktemp
-d)
43 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
45 if [ $DOMAIN = kernel
]; then
47 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-k chan
-s $SESSION_NAME --subbuf-size=8M
--num-subbuf=4
50 enable_
${DOMAIN}_lttng_event_ok
$SESSION_NAME "$WILDCARD" "$CHANNEL"
52 start_lttng_tracing_ok
55 ok $?
"Traced application stopped."
58 destroy_lttng_session_ok
$SESSION_NAME
60 if [ ${FIND} -eq 1 ]; then
61 trace_matches
$EVENT_NAME $NR_ITER $TRACE_PATH
63 trace_matches
$EVENT_NAME 0 $TRACE_PATH
69 function test_event_wildcard_fail
()
71 TRACE_PATH
=$
(mktemp
-d)
75 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
76 enable_
${DOMAIN}_lttng_event_fail
$SESSION_NAME "$WILDCARD"
77 destroy_lttng_session_ok
$SESSION_NAME
82 # MUST set TESTDIR before calling those functions
85 print_test_banner
"$TEST_DESC"
89 diag
"Test UST wildcard"
91 if [ ! -x "$TESTAPP_BIN" ]; then
92 BAIL_OUT
"No UST nevents binary detected."
95 EVENT_NAME
="tp:tptest"
98 test_event_wildcard ust
0 'tp:abc*'
99 test_event_wildcard ust
0 '*abc'
100 test_event_wildcard ust
0 '*z*'
101 test_event_wildcard ust
0 '*\**'
102 test_event_wildcard ust
0 '*\*'
103 test_event_wildcard ust
0 '\**'
104 test_event_wildcard ust
0 '*:*tpte*s'
105 test_event_wildcard ust
0 'tp**tpTest'
108 test_event_wildcard ust
1 'tp:tp*'
109 test_event_wildcard ust
1 '*'
110 test_event_wildcard ust
1 'tp:tptest*'
111 test_event_wildcard ust
1 '**'
112 test_event_wildcard ust
1 '***'
113 test_event_wildcard ust
1 '*tptest'
114 test_event_wildcard ust
1 '**tptest'
115 test_event_wildcard ust
1 '*tpte*'
116 test_event_wildcard ust
1 '*tp*'
117 test_event_wildcard ust
1 '*tp**'
118 test_event_wildcard ust
1 '*:*tptest'
119 test_event_wildcard ust
1 '*:*tpte*t'
120 test_event_wildcard ust
1 't*p*:*t*e*s*t'
121 test_event_wildcard ust
1 '*t*p*:*t*e*s*t*'
122 test_event_wildcard ust
1 'tp*tptest'
123 test_event_wildcard ust
1 'tp**tptest'
124 test_event_wildcard ust
1 'tp*test'
126 if [ "$(id -u)" == "0" ]; then
132 skip
$isroot "Root access is needed. Skipping all kernel wildcard tests." $NUM_KERNEL_TESTS ||
134 diag
"Test kernel wildcards"
138 EVENT_NAME
="lttng_test_filter_event"
141 test_event_wildcard kernel
0 'lttng_test_abc*'
142 test_event_wildcard kernel
0 '*abc'
143 test_event_wildcard kernel
0 '*z*'
144 test_event_wildcard kernel
0 '*\**'
145 test_event_wildcard kernel
0 '*\*'
146 test_event_wildcard kernel
0 '\**'
147 test_event_wildcard kernel
0 '*:*eve*n'
150 test_event_wildcard kernel
1 'lttng_test_fil*'
151 test_event_wildcard kernel
1 '*'
152 test_event_wildcard kernel
1 'lttng_test_filter_event*'
153 test_event_wildcard kernel
1 '**'
154 test_event_wildcard kernel
1 '***'
155 test_event_wildcard kernel
1 '*filter_event'
156 test_event_wildcard kernel
1 '*ter_ev*'
157 test_event_wildcard kernel
1 '*test*'
158 test_event_wildcard kernel
1 '*test**'
159 test_event_wildcard kernel
1 '*e*'
160 test_event_wildcard kernel
1 '*_*event'
161 test_event_wildcard kernel
1 '*_*filter_*nt'
162 test_event_wildcard kernel
1 '*_**filter_*nt'
163 test_event_wildcard kernel
1 'l*t*t*n*g*_*t*e*s*t*_*f*i*l*t*e*r*_*e*v*e*n*t'
164 test_event_wildcard kernel
1 '*l*t*t*n*g*_*t*e*s*t*_*f*i*l*t*e*r*_*e*v*e*n*t*'
165 test_event_wildcard kernel
1 'lttng*event'
166 test_event_wildcard kernel
1 'lttng*test*filter*event'
167 test_event_wildcard kernel
1 '*lttng*test*filter*event*'