3 # Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License, version 2 only, as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # You should have received a copy of the GNU General Public License along with
15 # this program; if not, write to the Free Software Foundation, Inc., 51
16 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 TEST_DESC
="Kernel tracer - Basic event"
26 source $TESTDIR/utils
/utils.sh
28 function test_event_basic
()
30 TRACE_PATH
=$
(mktemp
-d)
31 SESSION_NAME
="kernel_event_basic"
33 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
35 lttng_enable_kernel_event
$SESSION_NAME "sched_switch"
36 lttng_enable_kernel_event
$SESSION_NAME "sched_process_exit"
37 lttng_enable_kernel_event
$SESSION_NAME "sched_process_fork"
39 start_lttng_tracing_ok
41 # Running a process and waiting for its completion forces the triggering of
42 # fork, sched_switch and exit events
46 validate_trace
"sched_switch" $TRACE_PATH
47 validate_trace
"sched_process_exit" $TRACE_PATH
48 validate_trace
"sched_process_fork" $TRACE_PATH
50 destroy_lttng_session_ok
$SESSION_NAME
55 function test_enable_after_start
()
57 TRACE_PATH
=$
(mktemp
-d)
58 SESSION_NAME
="kernel_enable_after_start"
60 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
62 lttng_enable_kernel_event
$SESSION_NAME "sched_switch"
64 start_lttng_tracing_ok
65 lttng_enable_kernel_event
$SESSION_NAME "sched_process_exit"
67 # Running a process and waiting for its completion forces the triggering of
68 # sched_switch and exit events
72 validate_trace
"sched_switch" $TRACE_PATH
73 validate_trace
"sched_process_exit" $TRACE_PATH
75 destroy_lttng_session_ok
$SESSION_NAME
80 # MUST set TESTDIR before calling those functions
83 print_test_banner
"$TEST_DESC"
85 if [ "$(id -u)" == "0" ]; then
91 skip
$isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
96 test_enable_after_start