3 # Copyright (C) - 2013 Julien Desfossez <julien.desfossez@efficios.com>
4 # David Goulet <dgoulet@efficios.com>
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.
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
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
19 TEST_DESC
="Live - Kernel space tracing"
22 TESTDIR
=$CURDIR/..
/..
/..
/
23 SESSIOND_BIN
="lttng-sessiond"
24 RELAYD_BIN
="lttng-relayd"
29 EVENT_NAME
="sched_switch"
31 TRACE_PATH
=$
(mktemp
-d)
33 DIR
=$
(readlink
-f $TESTDIR)
37 source $TESTDIR/utils
/utils.sh
39 # MUST set TESTDIR before calling those functions
42 print_test_banner
"$TEST_DESC"
44 function setup_live_tracing
()
46 # Create session with default path
47 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN create
$SESSION_NAME --live $DELAY_USEC \
48 -U net
://localhost
>/dev
/null
2>&1
49 ok $?
"Create session in live mode with delay $DELAY_USEC"
51 lttng_enable_kernel_event
$SESSION_NAME $EVENT_NAME
52 start_lttng_tracing
$SESSION_NAME
55 function clean_live_tracing
()
57 stop_lttng_tracing
$SESSION_NAME
58 destroy_lttng_session
$SESSION_NAME
61 # Need root access for kernel tracing.
62 if [ "$(id -u)" == "0" ]; then
68 skip
$isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
71 start_lttng_relayd
"-o $TRACE_PATH"
75 # Just hit some events
80 validate_trace
$EVENT_NAME $TRACE_PATH