README.md: fix typos in component descriptions
[lttng-tools.git] / tests / regression / kernel / test_event_basic
CommitLineData
c87d483b
CB
1#!/bin/bash
2#
9d16b343 3# Copyright (C) 2013 Christian Babeux <christian.babeux@efficios.com>
c87d483b 4#
9d16b343 5# SPDX-License-Identifier: GPL-2.0-only
c87d483b 6#
c87d483b
CB
7
8TEST_DESC="Kernel tracer - Basic event"
9
10CURDIR=$(dirname $0)/
11TESTDIR=$CURDIR/../..
85ed2b26 12NUM_TESTS=20
c87d483b 13
e9826a9d
FD
14TESTCMD="/bin/true"
15
c87d483b
CB
16source $TESTDIR/utils/utils.sh
17
c87d483b
CB
18function test_event_basic()
19{
20 TRACE_PATH=$(mktemp -d)
21 SESSION_NAME="kernel_event_basic"
22
bf6ae429 23 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
c87d483b
CB
24
25 lttng_enable_kernel_event $SESSION_NAME "sched_switch"
26 lttng_enable_kernel_event $SESSION_NAME "sched_process_exit"
e9826a9d 27 lttng_enable_kernel_event $SESSION_NAME "sched_process_fork"
c87d483b 28
e563bbdb 29 start_lttng_tracing_ok
e9826a9d
FD
30
31 # Running a process and waiting for its completion forces the triggering of
32 # fork, sched_switch and exit events
33 eval ${TESTCMD}
96340a01 34 stop_lttng_tracing_ok
c87d483b
CB
35
36 validate_trace "sched_switch" $TRACE_PATH
37 validate_trace "sched_process_exit" $TRACE_PATH
e9826a9d 38 validate_trace "sched_process_fork" $TRACE_PATH
c87d483b 39
67b4c664 40 destroy_lttng_session_ok $SESSION_NAME
c87d483b
CB
41
42 rm -rf $TRACE_PATH
43}
44
85ed2b26
JD
45function test_enable_after_start()
46{
47 TRACE_PATH=$(mktemp -d)
48 SESSION_NAME="kernel_enable_after_start"
49
bf6ae429 50 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
85ed2b26
JD
51
52 lttng_enable_kernel_event $SESSION_NAME "sched_switch"
53
e563bbdb 54 start_lttng_tracing_ok
85ed2b26 55 lttng_enable_kernel_event $SESSION_NAME "sched_process_exit"
e9826a9d
FD
56
57 # Running a process and waiting for its completion forces the triggering of
58 # sched_switch and exit events
59 eval ${TESTCMD}
96340a01 60 stop_lttng_tracing_ok
85ed2b26
JD
61
62 validate_trace "sched_switch" $TRACE_PATH
63 validate_trace "sched_process_exit" $TRACE_PATH
64
67b4c664 65 destroy_lttng_session_ok $SESSION_NAME
85ed2b26
JD
66
67 rm -rf $TRACE_PATH
68}
69
c87d483b
CB
70# MUST set TESTDIR before calling those functions
71plan_tests $NUM_TESTS
72
e3bef725
CB
73print_test_banner "$TEST_DESC"
74
c87d483b
CB
75if [ "$(id -u)" == "0" ]; then
76 isroot=1
77else
78 isroot=0
79fi
80
81skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
82{
83 start_lttng_sessiond
84
85 test_event_basic
85ed2b26 86 test_enable_after_start
c87d483b
CB
87
88 stop_lttng_sessiond
89}
This page took 0.079969 seconds and 5 git commands to generate.