3 # Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com>
5 # SPDX-License-Identifier: GPL-2.0-only
8 TEST_DESC
="Kernel tracer - Basic event"
16 source $TESTDIR/utils
/utils.sh
18 function test_event_basic
()
20 TRACE_PATH
=$
(mktemp
-d)
21 SESSION_NAME
="kernel_event_basic"
23 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
25 lttng_enable_kernel_event
$SESSION_NAME "sched_switch"
26 lttng_enable_kernel_event
$SESSION_NAME "sched_process_exit"
27 lttng_enable_kernel_event
$SESSION_NAME "sched_process_fork"
29 start_lttng_tracing_ok
31 # Running a process and waiting for its completion forces the triggering of
32 # fork, sched_switch and exit events
36 validate_trace
"sched_switch" $TRACE_PATH
37 validate_trace
"sched_process_exit" $TRACE_PATH
38 validate_trace
"sched_process_fork" $TRACE_PATH
40 destroy_lttng_session_ok
$SESSION_NAME
45 function test_enable_after_start
()
47 TRACE_PATH
=$
(mktemp
-d)
48 SESSION_NAME
="kernel_enable_after_start"
50 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
52 lttng_enable_kernel_event
$SESSION_NAME "sched_switch"
54 start_lttng_tracing_ok
55 lttng_enable_kernel_event
$SESSION_NAME "sched_process_exit"
57 # Running a process and waiting for its completion forces the triggering of
58 # sched_switch and exit events
62 validate_trace
"sched_switch" $TRACE_PATH
63 validate_trace
"sched_process_exit" $TRACE_PATH
65 destroy_lttng_session_ok
$SESSION_NAME
70 # MUST set TESTDIR before calling those functions
73 print_test_banner
"$TEST_DESC"
75 if [ "$(id -u)" == "0" ]; then
81 skip
$isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
86 test_enable_after_start