Fix all -Wdiscarded-qualifiers warning instances
[lttng-tools.git] / tests / regression / tools / live / test_lttng_kernel
CommitLineData
1b368955
JD
1#!/bin/bash
2#
9d16b343
MJ
3# Copyright (C) 2013 Julien Desfossez <julien.desfossez@efficios.com>
4# Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
1b368955 5#
9d16b343 6# SPDX-License-Identifier: LGPL-2.1-only
1b368955
JD
7
8TEST_DESC="Live - Kernel space tracing"
9
10CURDIR=$(dirname $0)/
11TESTDIR=$CURDIR/../../../
1b368955
JD
12DELAY_USEC=2000000
13
14SESSION_NAME="live"
15EVENT_NAME="sched_switch"
16
17TRACE_PATH=$(mktemp -d)
18
19DIR=$(readlink -f $TESTDIR)
20
21NUM_TESTS=10
22
23source $TESTDIR/utils/utils.sh
24
25# MUST set TESTDIR before calling those functions
26plan_tests $NUM_TESTS
27
28print_test_banner "$TEST_DESC"
29
30function setup_live_tracing()
31{
32 # Create session with default path
33 $TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME --live $DELAY_USEC \
34 -U net://localhost >/dev/null 2>&1
35 ok $? "Create session in live mode with delay $DELAY_USEC"
36
37 lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
e563bbdb 38 start_lttng_tracing_ok $SESSION_NAME
1b368955
JD
39}
40
41function clean_live_tracing()
42{
96340a01 43 stop_lttng_tracing_ok $SESSION_NAME
67b4c664 44 destroy_lttng_session_ok $SESSION_NAME
1b368955
JD
45}
46
47# Need root access for kernel tracing.
48if [ "$(id -u)" == "0" ]; then
49 isroot=1
50else
51 isroot=0
52fi
53
54skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
55{
56 start_lttng_sessiond
57 start_lttng_relayd "-o $TRACE_PATH"
58
59 setup_live_tracing
60
61 # Just hit some events
62 sleep 2
63
64 clean_live_tracing
65
66 validate_trace $EVENT_NAME $TRACE_PATH
67 rm -rf $TRACE_PATH
68
69 stop_lttng_relayd
70 stop_lttng_sessiond
71}
This page took 0.037167 seconds and 4 git commands to generate.