Tests: add kernel test into the `make check` test suite.
[lttng-tools.git] / tests / regression / kernel / test_all_events
CommitLineData
a3ed20b4
CB
1#!/bin/bash
2#
9d16b343 3# Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com>
a3ed20b4 4#
9d16b343 5# SPDX-License-Identifier: GPL-2.0-only
a3ed20b4 6#
a3ed20b4
CB
7
8TEST_DESC="Kernel tracer - All events"
9
10CURDIR=$(dirname $0)/
11TESTDIR=$CURDIR/../..
12NUM_TESTS=8
13
e9826a9d
FD
14TESTCMD="/bin/true"
15
a3ed20b4
CB
16source $TESTDIR/utils/utils.sh
17
a3ed20b4
CB
18function test_all_event()
19{
7539dcec 20 local TRACE_PATH=$(mktemp --tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
a3ed20b4
CB
21 SESSION_NAME="kernel_all_events_basic"
22
bf6ae429 23 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
a3ed20b4
CB
24
25 lttng_enable_kernel_event $SESSION_NAME
26
e563bbdb 27 start_lttng_tracing_ok
e9826a9d
FD
28
29 # Running a process and waiting for its completion forces the triggering of a
30 # sched_switch event
31 eval ${TESTCMD}
96340a01 32 stop_lttng_tracing_ok
a3ed20b4
CB
33
34 validate_trace "sched_switch" $TRACE_PATH
35
67b4c664 36 destroy_lttng_session_ok $SESSION_NAME
a3ed20b4
CB
37
38 rm -rf $TRACE_PATH
39}
40
41# MUST set TESTDIR before calling those functions
42plan_tests $NUM_TESTS
43
e3bef725
CB
44print_test_banner "$TEST_DESC"
45
a3ed20b4
CB
46if [ "$(id -u)" == "0" ]; then
47 isroot=1
48else
49 isroot=0
50fi
51
52skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
53{
ebdd11df 54 validate_lttng_modules_present
a3ed20b4
CB
55 start_lttng_sessiond
56
57 test_all_event
58
59 stop_lttng_sessiond
60}
This page took 0.044133 seconds and 4 git commands to generate.