6da368fc6cc786052b64ed678071b842bdc09f3c
[lttng-tools.git] / tests / regression / tools / live / test_ust_tracefile_count
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
19 TEST_DESC="Live - User space tracing with tracefile_count"
20
21 CURDIR=$(dirname $0)/
22 TESTDIR=$CURDIR/../../../
23 NR_ITER=1
24 NR_USEC_WAIT=1
25 DELAY_USEC=2000000
26 TESTAPP_PATH="$TESTDIR/utils/testapp"
27 TESTAPP_NAME="gen-ust-events"
28 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
29
30 SESSION_NAME="live"
31 EVENT_NAME="tp:tptest"
32
33 TRACE_PATH=$(mktemp -d)
34
35 DIR=$(readlink -f $TESTDIR)
36
37 source $TESTDIR/utils/utils.sh
38
39 echo "$TEST_DESC"
40
41 function 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-channel --subbuf-size 16k -C 16k -W 10 -u chan1
48 $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$EVENT_NAME" -s $SESSION_NAME -u -c chan1 >/dev/null 2>&1
49 $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $SESSION_NAME >/dev/null 2>&1
50 }
51
52 function clean_live_tracing()
53 {
54 $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $SESSION_NAME >/dev/null 2>&1
55 $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $SESSION_NAME >/dev/null 2>&1
56 rm -rf $TRACE_PATH
57 }
58
59 file_sync_after_first=$(mktemp -u)
60
61 start_lttng_sessiond_notap
62 start_lttng_relayd_notap "-o $TRACE_PATH"
63
64 setup_live_tracing
65
66 # Run app in background
67 $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} >/dev/null 2>&1
68
69 while [ ! -f "${file_sync_after_first}" ]; do
70 sleep 0.5
71 done
72
73 # Start the live test
74 $TESTDIR/regression/tools/live/live_test
75
76 # Wait for the applications started in background
77 wait
78
79 clean_live_tracing
80
81 rm -f ${file_sync_after_first}
82
83 stop_lttng_relayd_notap
84 stop_lttng_sessiond_notap
This page took 0.044951 seconds and 4 git commands to generate.