Tests: remove declaration already present in utils.sh
[lttng-tools.git] / tests / regression / tools / exclusion / test_exclusion
1 #!/bin/bash
2 #
3 # Copyright (C) - 2012 Christian Babeux <christian.babeux@efficios.com>
4 #
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License, version 2 only, as
7 # published by the Free Software Foundation.
8 #
9 # This program is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 # more details.
13 #
14 # You should have received a copy of the GNU General Public License along with
15 # this program; if not, write to the Free Software Foundation, Inc., 51
16 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18 TEST_DESC="Event exclusion"
19
20 CURDIR=$(dirname $0)/
21 TESTDIR=$CURDIR/../../..
22 STATS_BIN="$TESTDIR/utils/babelstats.pl"
23 SESSION_NAME="test-exclusion"
24 EV_EXCLUDE_NAME="tp:tptest2"
25 TESTAPP_PATH="$TESTDIR/utils/testapp"
26 TESTAPP_NAME="gen-ust-nevents"
27 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
28 NR_ITER=100
29 NR_USEC_WAIT=1
30 NUM_TESTS=8
31
32 source $TESTDIR/utils/utils.sh
33
34 function enable_ust_lttng_all_event_exclusion()
35 {
36 sess_name="$1"
37 exclusion="$2"
38
39 $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event -a -s $sess_name -u -x "$exclusion" 2>&1 >/dev/null
40
41 ok $? "Enable lttng event with event $EV_EXCLUDE_NAME excluded"
42 }
43
44 function run_apps
45 {
46 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
47 }
48
49 function test_exclusion
50 {
51 trace_path=$(mktemp -d)
52
53 # Create session
54 create_lttng_session_ok $SESSION_NAME $trace_path
55
56 enable_ust_lttng_all_event_exclusion $SESSION_NAME $EV_EXCLUDE_NAME
57
58 # Trace apps
59 start_lttng_tracing_ok $SESSION_NAME
60 run_apps
61 stop_lttng_tracing_ok $SESSION_NAME
62
63 # Destroy session
64 destroy_lttng_session_ok $SESSION_NAME
65
66 stats=`babeltrace $trace_path | $STATS_BIN --tracepoint $EV_EXCLUDE_NAME | grep -v index`
67 if [ ! -z "$stats" ]; then
68 fail "Excluded event $EV_EXCLUDE_NAME was found in trace!"
69 else
70 ok 0 "Validate trace exclusion output"
71 rm -rf $trace_path
72 fi
73 }
74
75 plan_tests $NUM_TESTS
76
77 print_test_banner $TEST_DESC
78
79 start_lttng_sessiond
80
81 test_exclusion
82
83 stop_lttng_sessiond
This page took 0.031052 seconds and 4 git commands to generate.