Cleanup: run black on tree
[lttng-tools.git] / tests / regression / kernel / test_channel
CommitLineData
09b72f7a
FD
1#!/bin/bash
2#
9d16b343 3# Copyright (C) 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
09b72f7a 4#
9d16b343 5# SPDX-License-Identifier: GPL-2.0-only
09b72f7a 6#
09b72f7a
FD
7
8TEST_DESC="Kernel tracer - Channel configuration"
9
10CURDIR=$(dirname $0)/
11TESTDIR=$CURDIR/../..
12NUM_TESTS=8
13
14source $TESTDIR/utils/utils.sh
15
16function test_channel_buffer()
17{
8d5a3312 18 TRACE_PATH=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
09b72f7a
FD
19 SESSION_NAME="test_session_name"
20 CHANNEL_NAME="test_channel_name"
21 create_lttng_session_ok "$SESSION_NAME" "$TRACE_PATH"
22
23 # Try to create a tiny buffer.
24 lttng_enable_kernel_channel_ok "$SESSION_NAME" "$CHANNEL_NAME" --subbuf-size=4k --num-subbuf=1
25
26 destroy_lttng_session_ok "$SESSION_NAME"
27
28 rm -rf "$TRACE_PATH"
29}
30
31function test_channel_buffer_too_large()
32{
8d5a3312 33 TRACE_PATH=$(mktemp -d -t "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
09b72f7a
FD
34 SESSION_NAME="test_session_name"
35 CHANNEL_NAME="test_channel_name"
36 create_lttng_session_ok "$SESSION_NAME" "$TRACE_PATH"
37
38 # Try to create a buffer larger than memory. This testcase will need to
39 # be adjusted if someone has a computer with 1024*1000 GB of ram.
40 lttng_enable_kernel_channel_fail "$SESSION_NAME" "$CHANNEL_NAME" --subbuf-size=1000G --num-subbuf=1024
41
42 destroy_lttng_session_ok "$SESSION_NAME"
43
44 rm -rf "$TRACE_PATH"
45}
46
47plan_tests $NUM_TESTS
48print_test_banner "$TEST_DESC"
49
50if [ "$(id -u)" == "0" ]; then
51 isroot=1
52else
53 isroot=0
54fi
55
56skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
57{
58 start_lttng_sessiond
59
60 test_channel_buffer
61 test_channel_buffer_too_large
62
63 stop_lttng_sessiond
64}
This page took 0.045501 seconds and 4 git commands to generate.