Fix: kernel ctl error codes are based on errno
[lttng-tools.git] / tests / regression / kernel / test_event_basic
CommitLineData
c87d483b
CB
1#!/bin/bash
2#
3# Copyright (C) - 2013 Christian Babeux <christian.babeux@efficios.com>
4#
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.
8#
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
12# more details.
13#
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.
17
18TEST_DESC="Kernel tracer - Basic event"
19
20CURDIR=$(dirname $0)/
21TESTDIR=$CURDIR/../..
22NUM_TESTS=12
23
24source $TESTDIR/utils/utils.sh
25
c87d483b
CB
26function test_event_basic()
27{
28 TRACE_PATH=$(mktemp -d)
29 SESSION_NAME="kernel_event_basic"
30
31 create_lttng_session $SESSION_NAME $TRACE_PATH
32
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"
36
37 start_lttng_tracing
38 stop_lttng_tracing
39
40 validate_trace "sched_switch" $TRACE_PATH
41 validate_trace "sched_process_exit" $TRACE_PATH
42 validate_trace "sched_process_free" $TRACE_PATH
43
44 destroy_lttng_session $SESSION_NAME
45
46 rm -rf $TRACE_PATH
47}
48
49# MUST set TESTDIR before calling those functions
50plan_tests $NUM_TESTS
51
e3bef725
CB
52print_test_banner "$TEST_DESC"
53
c87d483b
CB
54if [ "$(id -u)" == "0" ]; then
55 isroot=1
56else
57 isroot=0
58fi
59
60skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
61{
62 start_lttng_sessiond
63
64 test_event_basic
65
66 stop_lttng_sessiond
67}
This page took 0.025056 seconds and 4 git commands to generate.