3 # Copyright (C) 2013 Julien Desfossez <julien.desfossez@efficios.com>
4 # Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
6 # SPDX-License-Identifier: LGPL-2.1-only
8 TEST_DESC
="Live - Kernel space tracing"
11 TESTDIR
=$CURDIR/..
/..
/..
/
15 EVENT_NAME
="sched_switch"
17 TRACE_PATH
=$
(mktemp
-d)
19 DIR
=$
(readlink
-f $TESTDIR)
23 source $TESTDIR/utils
/utils.sh
25 # MUST set TESTDIR before calling those functions
28 print_test_banner
"$TEST_DESC"
30 function setup_live_tracing
()
32 # Create session with default path
33 $TESTDIR/..
/src
/bin
/lttng
/$LTTNG_BIN create
$SESSION_NAME --live $DELAY_USEC \
34 -U net
://localhost
>/dev
/null
2>&1
35 ok $?
"Create session in live mode with delay $DELAY_USEC"
37 lttng_enable_kernel_event
$SESSION_NAME $EVENT_NAME
38 start_lttng_tracing_ok
$SESSION_NAME
41 function clean_live_tracing
()
43 stop_lttng_tracing_ok
$SESSION_NAME
44 destroy_lttng_session_ok
$SESSION_NAME
47 # Need root access for kernel tracing.
48 if [ "$(id -u)" == "0" ]; then
54 skip
$isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
57 start_lttng_relayd
"-o $TRACE_PATH"
61 # Just hit some events
66 validate_trace
$EVENT_NAME $TRACE_PATH