Refactor: test: wrapper for enable_ust_lttng_event
[lttng-tools.git] / tests / regression / tools / live / test_lttng_ust
CommitLineData
1b368955
JD
1#!/bin/bash
2#
3# Copyright (C) - 2013 Julien Desfossez <julien.desfossez@efficios.com>
4# David Goulet <dgoulet@efficios.com>
5#
6# This library is free software; you can redistribute it and/or modify it under
7# the terms of the GNU Lesser General Public License as published by the Free
8# Software Foundation; version 2.1 of the License.
9#
10# This library is distributed in the hope that it will be useful, but WITHOUT
11# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13# details.
14#
15# You should have received a copy of the GNU Lesser General Public License
16# along with this library; if not, write to the Free Software Foundation, Inc.,
17# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19TEST_DESC="Live - User space tracing"
20
21CURDIR=$(dirname $0)/
22TESTDIR=$CURDIR/../../../
23SESSIOND_BIN="lttng-sessiond"
24RELAYD_BIN="lttng-relayd"
25LTTNG_BIN="lttng"
26BABELTRACE_BIN="babeltrace"
27NR_ITER=1
28NR_USEC_WAIT=1
29DELAY_USEC=2000000
30TESTAPP_PATH="$TESTDIR/utils/testapp"
31TESTAPP_NAME="gen-ust-events"
32TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
33
34SESSION_NAME="live"
35EVENT_NAME="tp:tptest"
36
37TRACE_PATH=$(mktemp -d)
38
39DIR=$(readlink -f $TESTDIR)
40
1a241656 41NUM_TESTS=11
1b368955
JD
42
43source $TESTDIR/utils/utils.sh
44
45# MUST set TESTDIR before calling those functions
46plan_tests $NUM_TESTS
47
48print_test_banner "$TEST_DESC"
49
1a241656
DG
50function test_custom_url()
51{
52 # Create session with custom URL
53 $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \
54 -C tcp://localhost:1819 -D tcp://localhost:9187 >/dev/null 2>&1
55 ok $? "Create session in live mode with delay $DELAY_USEC and custom URLs"
56}
57
1b368955
JD
58function setup_live_tracing()
59{
60 # Create session with default path
61 $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \
62 -U net://localhost >/dev/null 2>&1
63 ok $? "Create session in live mode with delay $DELAY_USEC"
64
c4926bb5 65 enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
1b368955
JD
66 start_lttng_tracing $SESSION_NAME
67}
68
69function clean_live_tracing()
70{
71 stop_lttng_tracing $SESSION_NAME
72 destroy_lttng_session $SESSION_NAME
73}
74
75start_lttng_sessiond
76start_lttng_relayd "-o $TRACE_PATH"
77
78setup_live_tracing
79
80# Run app in background
f8ccb5c8 81$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
1b368955
JD
82
83clean_live_tracing
84
d53addeb 85trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH
1b368955 86rm -rf $TRACE_PATH
1b368955 87stop_lttng_relayd
1a241656
DG
88
89test_custom_url
90pkill $RELAYD_BIN
91
1b368955 92stop_lttng_sessiond
This page took 0.033275 seconds and 5 git commands to generate.