Introduce libcommon-lgpl for liblttng-ctl
[lttng-tools.git] / tests / regression / tools / live / test_ust
CommitLineData
1b368955
JD
1#!/bin/bash
2#
9d16b343
MJ
3# Copyright (C) 2013 Julien Desfossez <julien.desfossez@efficios.com>
4# Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
1b368955 5#
9d16b343 6# SPDX-License-Identifier: LGPL-2.1-only
1b368955
JD
7
8TEST_DESC="Live - User space tracing"
9
10CURDIR=$(dirname $0)/
11TESTDIR=$CURDIR/../../../
1b368955
JD
12NR_ITER=1
13NR_USEC_WAIT=1
14DELAY_USEC=2000000
15TESTAPP_PATH="$TESTDIR/utils/testapp"
16TESTAPP_NAME="gen-ust-events"
17TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
18
19SESSION_NAME="live"
20EVENT_NAME="tp:tptest"
21
33e55711 22TRACE_PATH=$(mktemp --tmpdir -d tmp.test_live_ust_trace_path.XXXXXX)
1b368955
JD
23
24DIR=$(readlink -f $TESTDIR)
25
26source $TESTDIR/utils/utils.sh
27
28echo "$TEST_DESC"
29
30function setup_live_tracing()
31{
32 # Create session with default path
33 $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \
34 -U net://localhost >/dev/null 2>&1
35
36 $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$EVENT_NAME" -s $SESSION_NAME -u >/dev/null 2>&1
37 $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $SESSION_NAME >/dev/null 2>&1
38}
39
40function clean_live_tracing()
41{
42 $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $SESSION_NAME >/dev/null 2>&1
43 $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $SESSION_NAME >/dev/null 2>&1
44 rm -rf $TRACE_PATH
45}
46
33e55711 47file_sync_after_first=$(mktemp --tmpdir -u tmp.test_live_ust_sync_after_first.XXXXXX)
05aa48da
MD
48
49start_lttng_sessiond_notap
50start_lttng_relayd_notap "-o $TRACE_PATH"
1b368955
JD
51
52setup_live_tracing
53
6c4a91d6 54$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1
05aa48da
MD
55
56while [ ! -f "${file_sync_after_first}" ]; do
57 sleep 0.5
58done
1b368955
JD
59
60# Start the live test
61$TESTDIR/regression/tools/live/live_test
62
63clean_live_tracing
64
05aa48da
MD
65rm -f ${file_sync_after_first}
66
05aa48da 67stop_lttng_sessiond_notap
165b4553 68stop_lttng_relayd_notap
This page took 0.046741 seconds and 4 git commands to generate.