3 # Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
4 # Copyright (C) - 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU General Public License, version 2 only, as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 # You should have received a copy of the GNU General Public License along with
16 # this program; if not, write to the Free Software Foundation, Inc., 51
17 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 TEST_DESC
="LTTng - Event wildcard test"
22 TESTDIR
=$CURDIR/..
/..
/..
23 TESTAPP_PATH
="$TESTDIR/utils/testapp"
24 TESTAPP_NAME
="gen-ust-events"
25 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
26 SESSION_NAME
="wildcard"
29 NUM_UST_TESTS
=$
(( 7 * 25 ))
30 NUM_KERNEL_TESTS
=$
(( 7 * 25 ))
31 NUM_TESTS
=$
(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
33 source $TESTDIR/utils
/utils.sh
37 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT
42 # Trigger the event for 100 iterations
43 echo -n "100" > /proc
/lttng-test-filter-event
46 function test_event_wildcard
()
48 TRACE_PATH
=$
(mktemp
-d)
54 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
56 if [ $DOMAIN = kernel
]; then
58 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN enable-channel
-k chan
-s $SESSION_NAME --subbuf-size=8M
--num-subbuf=4
61 enable_
${DOMAIN}_lttng_event_ok
$SESSION_NAME "$WILDCARD" "$CHANNEL"
63 start_lttng_tracing_ok
66 ok $?
"Traced application stopped."
69 destroy_lttng_session_ok
$SESSION_NAME
71 if [ ${FIND} -eq 1 ]; then
72 trace_matches
$EVENT_NAME $NR_ITER $TRACE_PATH
74 trace_matches
$EVENT_NAME 0 $TRACE_PATH
80 function test_event_wildcard_fail
()
82 TRACE_PATH
=$
(mktemp
-d)
86 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
87 enable_
${DOMAIN}_lttng_event_fail
$SESSION_NAME "$WILDCARD"
88 destroy_lttng_session_ok
$SESSION_NAME
93 # MUST set TESTDIR before calling those functions
96 print_test_banner
"$TEST_DESC"
100 diag
"Test UST wildcard"
102 if [ ! -x "$TESTAPP_BIN" ]; then
103 BAIL_OUT
"No UST nevents binary detected."
106 EVENT_NAME
="tp:tptest"
109 test_event_wildcard ust
0 'tp:abc*'
110 test_event_wildcard ust
0 '*abc'
111 test_event_wildcard ust
0 '*z*'
112 test_event_wildcard ust
0 '*\**'
113 test_event_wildcard ust
0 '*\*'
114 test_event_wildcard ust
0 '\**'
115 test_event_wildcard ust
0 '*:*tpte*s'
116 test_event_wildcard ust
0 'tp**tpTest'
119 test_event_wildcard ust
1 'tp:tp*'
120 test_event_wildcard ust
1 '*'
121 test_event_wildcard ust
1 'tp:tptest*'
122 test_event_wildcard ust
1 '**'
123 test_event_wildcard ust
1 '***'
124 test_event_wildcard ust
1 '*tptest'
125 test_event_wildcard ust
1 '**tptest'
126 test_event_wildcard ust
1 '*tpte*'
127 test_event_wildcard ust
1 '*tp*'
128 test_event_wildcard ust
1 '*tp**'
129 test_event_wildcard ust
1 '*:*tptest'
130 test_event_wildcard ust
1 '*:*tpte*t'
131 test_event_wildcard ust
1 't*p*:*t*e*s*t'
132 test_event_wildcard ust
1 '*t*p*:*t*e*s*t*'
133 test_event_wildcard ust
1 'tp*tptest'
134 test_event_wildcard ust
1 'tp**tptest'
135 test_event_wildcard ust
1 'tp*test'
137 if [ "$(id -u)" == "0" ]; then
143 skip
$isroot "Root access is needed. Skipping all kernel wildcard tests." $NUM_KERNEL_TESTS ||
145 diag
"Test kernel wildcards"
149 EVENT_NAME
="lttng_test_filter_event"
152 test_event_wildcard kernel
0 'lttng_test_abc*'
153 test_event_wildcard kernel
0 '*abc'
154 test_event_wildcard kernel
0 '*z*'
155 test_event_wildcard kernel
0 '*\**'
156 test_event_wildcard kernel
0 '*\*'
157 test_event_wildcard kernel
0 '\**'
158 test_event_wildcard kernel
0 '*:*eve*n'
161 test_event_wildcard kernel
1 'lttng_test_fil*'
162 test_event_wildcard kernel
1 '*'
163 test_event_wildcard kernel
1 'lttng_test_filter_event*'
164 test_event_wildcard kernel
1 '**'
165 test_event_wildcard kernel
1 '***'
166 test_event_wildcard kernel
1 '*filter_event'
167 test_event_wildcard kernel
1 '*ter_ev*'
168 test_event_wildcard kernel
1 '*test*'
169 test_event_wildcard kernel
1 '*test**'
170 test_event_wildcard kernel
1 '*e*'
171 test_event_wildcard kernel
1 '*_*event'
172 test_event_wildcard kernel
1 '*_*filter_*nt'
173 test_event_wildcard kernel
1 '*_**filter_*nt'
174 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'
175 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*'
176 test_event_wildcard kernel
1 'lttng*event'
177 test_event_wildcard kernel
1 'lttng*test*filter*event'
178 test_event_wildcard kernel
1 '*lttng*test*filter*event*'