Fix: regression tests
[lttng-tools.git] / tests / regression / tools / live / test_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/../../../
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
41source $TESTDIR/utils/utils.sh
42
43echo "$TEST_DESC"
44
45function setup_live_tracing()
46{
47 # Create session with default path
48 $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \
49 -U net://localhost >/dev/null 2>&1
50
51 $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$EVENT_NAME" -s $SESSION_NAME -u >/dev/null 2>&1
52 $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $SESSION_NAME >/dev/null 2>&1
53}
54
55function clean_live_tracing()
56{
57 $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $SESSION_NAME >/dev/null 2>&1
58 $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $SESSION_NAME >/dev/null 2>&1
59 rm -rf $TRACE_PATH
60}
61
62file_sync_after_first=$(mktemp -u)
63
64start_lttng_sessiond_notap
65start_lttng_relayd_notap "-o $TRACE_PATH"
66
67setup_live_tracing
68
69# Run app in background
70$TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} >/dev/null 2>&1
71
72while [ ! -f "${file_sync_after_first}" ]; do
73 sleep 0.5
74done
75
76# Start the live test
77$TESTDIR/regression/tools/live/live_test
78
79# Wait for the applications started in background
80wait
81
82clean_live_tracing
83
84rm -f ${file_sync_after_first}
85
86stop_lttng_relayd_notap
87stop_lttng_sessiond_notap
This page took 0.024378 seconds and 4 git commands to generate.