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/..
/..
/..
/
26 EVENT_NAME
="sched_switch"
28 TRACE_PATH
=$
(mktemp
-d)
30 DIR
=$
(readlink
-f $TESTDIR)
34 source $TESTDIR/utils
/utils.sh
36 # MUST set TESTDIR before calling those functions
39 print_test_banner
"$TEST_DESC"
41 function setup_live_tracing
()
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 ok $?
"Create session in live mode with delay $DELAY_USEC"
48 lttng_enable_kernel_event
$SESSION_NAME $EVENT_NAME
49 start_lttng_tracing_ok
$SESSION_NAME
52 function clean_live_tracing
()
54 stop_lttng_tracing_ok
$SESSION_NAME
55 destroy_lttng_session_ok
$SESSION_NAME
58 # Need root access for kernel tracing.
59 if [ "$(id -u)" == "0" ]; then
65 skip
$isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
68 start_lttng_relayd
"-o $TRACE_PATH"
72 # Just hit some events
77 validate_trace
$EVENT_NAME $TRACE_PATH