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 -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
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_path_kernel
"$TRACE_PATH" ""
37 validate_trace
"sched_switch" $TRACE_PATH
38 validate_trace
"sched_process_exit" $TRACE_PATH
39 validate_trace
"sched_process_fork" $TRACE_PATH
41 destroy_lttng_session_ok
$SESSION_NAME
46 function test_enable_after_start
()
48 TRACE_PATH
=$
(mktemp
-d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
49 SESSION_NAME
="kernel_enable_after_start"
51 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
53 lttng_enable_kernel_event
$SESSION_NAME "sched_switch"
55 start_lttng_tracing_ok
56 lttng_enable_kernel_event
$SESSION_NAME "sched_process_exit"
58 # Running a process and waiting for its completion forces the triggering of
59 # sched_switch and exit events
63 validate_trace
"sched_switch" $TRACE_PATH
64 validate_trace
"sched_process_exit" $TRACE_PATH
66 destroy_lttng_session_ok
$SESSION_NAME
71 # MUST set TESTDIR before calling those functions
74 print_test_banner
"$TEST_DESC"
76 check_skip_kernel_test
$NUM_TESTS "Skipping all tests." ||
78 validate_lttng_modules_present
82 test_enable_after_start