Commit | Line | Data |
---|---|---|
3de31d0b CB |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com> | |
075ffe1f | 4 | # Copyright (C) - 2015 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
3de31d0b CB |
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)/ | |
f34b33a2 | 22 | TESTDIR=$CURDIR/../../.. |
3de31d0b | 23 | LTTNG_BIN="lttng" |
075ffe1f MD |
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" | |
3de31d0b | 28 | EVENT_NAME="tp:tptest" |
075ffe1f MD |
29 | NUM_TESTS=39 |
30 | NR_ITER=100 | |
3de31d0b CB |
31 | |
32 | source $TESTDIR/utils/utils.sh | |
33 | ||
075ffe1f MD |
34 | if [ ! -x "$TESTAPP_BIN" ]; then |
35 | BAIL_OUT "No UST nevents binary detected." | |
36 | fi | |
37 | ||
3de31d0b CB |
38 | function test_event_wildcard() |
39 | { | |
40 | TRACE_PATH=$(mktemp -d) | |
075ffe1f MD |
41 | FIND="${1}" |
42 | WILDCARD="${2}" | |
3de31d0b | 43 | |
bf6ae429 | 44 | create_lttng_session_ok $SESSION_NAME $TRACE_PATH |
075ffe1f | 45 | enable_ust_lttng_event_ok $SESSION_NAME "$WILDCARD" |
3de31d0b | 46 | |
e563bbdb | 47 | start_lttng_tracing_ok |
075ffe1f MD |
48 | |
49 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
50 | ok $? "Traced application stopped." | |
51 | ||
96340a01 | 52 | stop_lttng_tracing_ok |
075ffe1f MD |
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 | } | |
3de31d0b | 63 | |
075ffe1f MD |
64 | function test_event_wildcard_fail() |
65 | { | |
66 | TRACE_PATH=$(mktemp -d) | |
67 | WILDCARD="${1}" | |
3de31d0b | 68 | |
075ffe1f MD |
69 | create_lttng_session_ok $SESSION_NAME $TRACE_PATH |
70 | enable_ust_lttng_event_fail $SESSION_NAME "$WILDCARD" | |
67b4c664 | 71 | destroy_lttng_session_ok $SESSION_NAME |
3de31d0b CB |
72 | |
73 | rm -rf $TRACE_PATH | |
74 | } | |
75 | ||
075ffe1f | 76 | |
3de31d0b CB |
77 | # MUST set TESTDIR before calling those functions |
78 | plan_tests $NUM_TESTS | |
79 | ||
e3bef725 CB |
80 | print_test_banner "$TEST_DESC" |
81 | ||
3de31d0b CB |
82 | start_lttng_sessiond |
83 | ||
075ffe1f MD |
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*' | |
3de31d0b CB |
92 | |
93 | stop_lttng_sessiond |