Cleanup: Tests: live/test_{lttng_,}ust: testapp not in background
[lttng-tools.git] / tests / regression / tools / live / test_ust
1 #!/bin/bash
2 #
3 # Copyright (C) 2013 Julien Desfossez <julien.desfossez@efficios.com>
4 # Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
5 #
6 # SPDX-License-Identifier: LGPL-2.1-only
7
8 TEST_DESC="Live - User space tracing"
9
10 CURDIR=$(dirname $0)/
11 TESTDIR=$CURDIR/../../../
12 NR_ITER=1
13 NR_USEC_WAIT=1
14 DELAY_USEC=2000000
15 TESTAPP_PATH="$TESTDIR/utils/testapp"
16 TESTAPP_NAME="gen-ust-events"
17 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
18
19 SESSION_NAME="live"
20 EVENT_NAME="tp:tptest"
21
22 TRACE_PATH=$(mktemp -d)
23
24 DIR=$(readlink -f $TESTDIR)
25
26 source $TESTDIR/utils/utils.sh
27
28 echo "$TEST_DESC"
29
30 function 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
40 function 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
47 file_sync_after_first=$(mktemp -u)
48
49 start_lttng_sessiond_notap
50 start_lttng_relayd_notap "-o $TRACE_PATH"
51
52 setup_live_tracing
53
54 $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1
55
56 while [ ! -f "${file_sync_after_first}" ]; do
57 sleep 0.5
58 done
59
60 # Start the live test
61 $TESTDIR/regression/tools/live/live_test
62
63 clean_live_tracing
64
65 rm -f ${file_sync_after_first}
66
67 stop_lttng_sessiond_notap
68 stop_lttng_relayd_notap
This page took 0.044788 seconds and 4 git commands to generate.