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"
24 source $TESTDIR/utils
/utils.sh
26 function test_event_basic
()
28 TRACE_PATH
=$
(mktemp
-d)
29 SESSION_NAME
="kernel_event_basic"
31 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
33 lttng_enable_kernel_event
$SESSION_NAME "sched_switch"
34 lttng_enable_kernel_event
$SESSION_NAME "sched_process_exit"
35 lttng_enable_kernel_event
$SESSION_NAME "sched_process_free"
37 start_lttng_tracing_ok
40 validate_trace
"sched_switch" $TRACE_PATH
41 validate_trace
"sched_process_exit" $TRACE_PATH
42 validate_trace
"sched_process_free" $TRACE_PATH
44 destroy_lttng_session_ok
$SESSION_NAME
49 function test_enable_after_start
()
51 TRACE_PATH
=$
(mktemp
-d)
52 SESSION_NAME
="kernel_enable_after_start"
54 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
56 lttng_enable_kernel_event
$SESSION_NAME "sched_switch"
58 start_lttng_tracing_ok
59 lttng_enable_kernel_event
$SESSION_NAME "sched_process_exit"
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