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