Gen-ust-events: use options instead of arguments
[lttng-tools.git] / tests / regression / tools / live / test_kernel
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 - Kernel space tracing"
20
21CURDIR=$(dirname $0)/
22TESTDIR=$CURDIR/../../../
1b368955
JD
23NR_ITER=1
24NR_USEC_WAIT=1
25DELAY_USEC=2000000
26
27SESSION_NAME="live"
28EVENT_NAME="sched_switch"
29
30TRACE_PATH=$(mktemp -d)
31
32DIR=$(readlink -f $TESTDIR)
33
34source $TESTDIR/utils/utils.sh
35
36function 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
46function 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.
54if [ "$(id -u)" == "0" ]; then
55 isroot=1
56else
57 echo "Root access is needed. Skipping all tests."
58 exit 0
59fi
60
05aa48da
MD
61start_lttng_sessiond_notap
62start_lttng_relayd_notap "-o $TRACE_PATH"
1b368955
JD
63
64setup_live_tracing
65
66# Start the live test
67$TESTDIR/regression/tools/live/live_test
68
69clean_live_tracing
70
05aa48da
MD
71stop_lttng_relayd_notap
72stop_lttng_sessiond_notap
This page took 0.046277 seconds and 5 git commands to generate.