Tests: remove declaration already present in utils.sh
[lttng-tools.git] / tests / regression / tools / live / test_kernel
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 - Kernel space tracing"
20
21 CURDIR=$(dirname $0)/
22 TESTDIR=$CURDIR/../../../
23 NR_ITER=1
24 NR_USEC_WAIT=1
25 DELAY_USEC=2000000
26
27 SESSION_NAME="live"
28 EVENT_NAME="sched_switch"
29
30 TRACE_PATH=$(mktemp -d)
31
32 DIR=$(readlink -f $TESTDIR)
33
34 source $TESTDIR/utils/utils.sh
35
36 function setup_live_tracing()
37 {
38 # Create session with default path
39 $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \
40 -U net://localhost >/dev/null 2>&1
41
42 $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$EVENT_NAME" -s $SESSION_NAME -k >/dev/null 2>&1
43 $TESTDIR/../src/bin/lttng/$LTTNG_BIN start $SESSION_NAME >/dev/null 2>&1
44 }
45
46 function clean_live_tracing()
47 {
48 $TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $SESSION_NAME >/dev/null 2>&1
49 $TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $SESSION_NAME >/dev/null 2>&1
50 rm -rf $TRACE_PATH
51 }
52
53 # Need root access for kernel tracing.
54 if [ "$(id -u)" == "0" ]; then
55 isroot=1
56 else
57 echo "Root access is needed. Skipping all tests."
58 exit 0
59 fi
60
61 start_lttng_sessiond_notap
62 start_lttng_relayd_notap "-o $TRACE_PATH"
63
64 setup_live_tracing
65
66 # Start the live test
67 $TESTDIR/regression/tools/live/live_test
68
69 clean_live_tracing
70
71 stop_lttng_relayd_notap
72 stop_lttng_sessiond_notap
This page took 0.032834 seconds and 5 git commands to generate.