7fbfc18395ba8b8c7221fdac0edce22e3abf3429
[lttng-tools.git] / tests / regression / tools / wildcard / test_event_wildcard
1 #!/bin/bash
2 #
3 # Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
4 # Copyright (C) - 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 #
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.
9 #
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
13 # more details.
14 #
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.
18
19 TEST_DESC="UST tracer - Event wildcard"
20
21 CURDIR=$(dirname $0)/
22 TESTDIR=$CURDIR/../..
23 LTTNG_BIN="lttng"
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"
28 EVENT_NAME="tp:tptest"
29 NUM_TESTS=39
30 NR_ITER=100
31
32 source $TESTDIR/utils/utils.sh
33
34 if [ ! -x "$TESTAPP_BIN" ]; then
35 BAIL_OUT "No UST nevents binary detected."
36 fi
37
38 function test_event_wildcard()
39 {
40 TRACE_PATH=$(mktemp -d)
41 FIND="${1}"
42 WILDCARD="${2}"
43
44 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
45 enable_ust_lttng_event_ok $SESSION_NAME "$WILDCARD"
46
47 start_lttng_tracing_ok
48
49 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT
50 ok $? "Traced application stopped."
51
52 stop_lttng_tracing_ok
53 destroy_lttng_session_ok $SESSION_NAME
54
55 if [ ${FIND} -eq 1 ]; then
56 trace_matches $EVENT_NAME $NR_ITER $TRACE_PATH
57 else
58 validate_trace_empty $TRACE_PATH
59 fi
60
61 rm -rf $TRACE_PATH
62 }
63
64 function test_event_wildcard_fail()
65 {
66 TRACE_PATH=$(mktemp -d)
67 WILDCARD="${1}"
68
69 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
70 enable_ust_lttng_event_fail $SESSION_NAME "$WILDCARD"
71 destroy_lttng_session_ok $SESSION_NAME
72
73 rm -rf $TRACE_PATH
74 }
75
76
77 # MUST set TESTDIR before calling those functions
78 plan_tests $NUM_TESTS
79
80 print_test_banner "$TEST_DESC"
81
82 start_lttng_sessiond
83
84 test_event_wildcard 1 'tp:tp*'
85 test_event_wildcard 1 '*'
86 test_event_wildcard 1 'tp:tptest*'
87 test_event_wildcard 0 'tp:abc*'
88
89 test_event_wildcard_fail 'tp:*tp'
90 test_event_wildcard_fail 'tp:tp**'
91 test_event_wildcard_fail '*tp:tp*'
92
93 stop_lttng_sessiond
This page took 0.030518 seconds and 3 git commands to generate.