Tests: Use stop relayd from utils.sh
[lttng-tools.git] / tests / regression / tools / live / test_lttng_ust
... / ...
CommitLineData
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/../../../
23NR_ITER=1
24NR_USEC_WAIT=1
25DELAY_USEC=2000000
26TESTAPP_PATH="$TESTDIR/utils/testapp"
27TESTAPP_NAME="gen-ust-events"
28TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
29
30SESSION_NAME="live"
31EVENT_NAME="tp:tptest"
32
33TRACE_PATH=$(mktemp -d)
34
35DIR=$(readlink -f $TESTDIR)
36
37NUM_TESTS=12
38
39source $TESTDIR/utils/utils.sh
40
41# MUST set TESTDIR before calling those functions
42plan_tests $NUM_TESTS
43
44print_test_banner "$TEST_DESC"
45
46function test_custom_url()
47{
48 # Create session with custom URL
49 $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \
50 -C tcp://localhost:1819 -D tcp://localhost:9187 >/dev/null 2>&1
51 ok $? "Create session in live mode with delay $DELAY_USEC and custom URLs"
52}
53
54function setup_live_tracing()
55{
56 # Create session with default path
57 $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \
58 -U net://localhost >/dev/null 2>&1
59 ok $? "Create session in live mode with delay $DELAY_USEC"
60
61 enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
62 start_lttng_tracing_ok $SESSION_NAME
63}
64
65function clean_live_tracing()
66{
67 stop_lttng_tracing_ok $SESSION_NAME
68 destroy_lttng_session_ok $SESSION_NAME
69}
70
71start_lttng_sessiond
72start_lttng_relayd "-o $TRACE_PATH"
73
74setup_live_tracing
75
76# Run app in background
77$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
78
79clean_live_tracing
80
81trace_match_only $EVENT_NAME $NR_ITER $TRACE_PATH
82rm -rf $TRACE_PATH
83stop_lttng_relayd
84
85test_custom_url
86
87stop_lttng_relayd
88stop_lttng_sessiond
This page took 0.02585 seconds and 5 git commands to generate.