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/..
/..
/..
24 TESTAPP_PATH
="$TESTDIR/utils/testapp"
25 TESTAPP_NAME
="gen-ust-events"
26 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
27 SESSION_NAME
="wildcard"
32 NUM_TESTS
=$
(($NUM_UST_TESTS+$NUM_KERNEL_TESTS+$NUM_GLOBAL_TESTS))
34 source $TESTDIR/utils
/utils.sh
38 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
43 # Trigger the event for 100 iterations
44 echo -n "100" > /proc
/lttng-test-filter-event
47 function test_event_wildcard
()
49 TRACE_PATH
=$
(mktemp
-d)
54 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
55 enable_
${DOMAIN}_lttng_event_ok
$SESSION_NAME "$WILDCARD"
57 start_lttng_tracing_ok
60 ok $?
"Traced application stopped."
63 destroy_lttng_session_ok
$SESSION_NAME
65 if [ ${FIND} -eq 1 ]; then
66 trace_matches
$EVENT_NAME $NR_ITER $TRACE_PATH
68 validate_trace_empty
$TRACE_PATH
74 function test_event_wildcard_fail
()
76 TRACE_PATH
=$
(mktemp
-d)
80 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
81 enable_
${DOMAIN}_lttng_event_fail
$SESSION_NAME "$WILDCARD"
82 destroy_lttng_session_ok
$SESSION_NAME
87 # MUST set TESTDIR before calling those functions
90 print_test_banner
"$TEST_DESC"
94 diag
"Test UST wildcard"
96 if [ ! -x "$TESTAPP_BIN" ]; then
97 BAIL_OUT
"No UST nevents binary detected."
100 EVENT_NAME
="tp:tptest"
102 test_event_wildcard ust
1 'tp:tp*'
103 test_event_wildcard ust
1 '*'
104 test_event_wildcard ust
1 'tp:tptest*'
105 test_event_wildcard ust
0 'tp:abc*'
107 test_event_wildcard_fail ust
'tp:*tp'
108 test_event_wildcard_fail ust
'tp:tp**'
109 test_event_wildcard_fail ust
'*tp:tp*'
112 if [ "$(id -u)" == "0" ]; then
118 skip
$isroot "Root access is needed. Skipping all kernel wildcard tests." $NUM_KERNEL_TESTS ||
120 diag
"Test kernel wildcards"
124 EVENT_NAME
="lttng_test_filter_event"
126 test_event_wildcard kernel
1 'lttng_test_*'
127 test_event_wildcard kernel
1 '*'
128 test_event_wildcard kernel
1 'lttng_test_filter_event*'
129 test_event_wildcard kernel
0 'lttng_test_asdfasdf*'
131 test_event_wildcard_fail kernel
'tp_*tp'
132 test_event_wildcard_fail kernel
'tp_tp**'
133 test_event_wildcard_fail kernel
'*tp_tp*'