doc: document untrack command in lttng(1)
[lttng-tools.git] / tests / regression / tools / wildcard / test_event_wildcard
CommitLineData
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
19TEST_DESC="UST tracer - Event wildcard"
20
21CURDIR=$(dirname $0)/
22TESTDIR=$CURDIR/../..
23LTTNG_BIN="lttng"
075ffe1f
MD
24TESTAPP_PATH="$TESTDIR/utils/testapp"
25TESTAPP_NAME="gen-ust-events"
26TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
27SESSION_NAME="wildcard"
3de31d0b 28EVENT_NAME="tp:tptest"
075ffe1f
MD
29NUM_TESTS=39
30NR_ITER=100
3de31d0b
CB
31
32source $TESTDIR/utils/utils.sh
33
075ffe1f
MD
34if [ ! -x "$TESTAPP_BIN" ]; then
35 BAIL_OUT "No UST nevents binary detected."
36fi
37
3de31d0b
CB
38function 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
64function 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
78plan_tests $NUM_TESTS
79
e3bef725
CB
80print_test_banner "$TEST_DESC"
81
3de31d0b
CB
82start_lttng_sessiond
83
075ffe1f
MD
84test_event_wildcard 1 'tp:tp*'
85test_event_wildcard 1 '*'
86test_event_wildcard 1 'tp:tptest*'
87test_event_wildcard 0 'tp:abc*'
88
89test_event_wildcard_fail 'tp:*tp'
90test_event_wildcard_fail 'tp:tp**'
91test_event_wildcard_fail '*tp:tp*'
3de31d0b
CB
92
93stop_lttng_sessiond
This page took 0.031554 seconds and 4 git commands to generate.