X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Fregression%2Fkernel%2Ftest_channel;fp=tests%2Fregression%2Fkernel%2Ftest_channel;h=cb0fa5183e87fcfb0f4383c38e83f1b9b3553a38;hp=0000000000000000000000000000000000000000;hb=09b72f7aa737f46196db18bcdf3bc947a08c27a2;hpb=bd3739b081f96057a93a234e6ac1c98a9a44ca39 diff --git a/tests/regression/kernel/test_channel b/tests/regression/kernel/test_channel new file mode 100755 index 000000000..cb0fa5183 --- /dev/null +++ b/tests/regression/kernel/test_channel @@ -0,0 +1,74 @@ +#!/bin/bash +# +# Copyright (C) - 2018 Francis Deslauriers +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License, version 2 only, as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, write to the Free Software Foundation, Inc., 51 +# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +TEST_DESC="Kernel tracer - Channel configuration" + +CURDIR=$(dirname $0)/ +TESTDIR=$CURDIR/../.. +NUM_TESTS=8 + +source $TESTDIR/utils/utils.sh + +function test_channel_buffer() +{ + TRACE_PATH=$(mktemp -d) + SESSION_NAME="test_session_name" + CHANNEL_NAME="test_channel_name" + create_lttng_session_ok "$SESSION_NAME" "$TRACE_PATH" + + # Try to create a tiny buffer. + lttng_enable_kernel_channel_ok "$SESSION_NAME" "$CHANNEL_NAME" --subbuf-size=4k --num-subbuf=1 + + destroy_lttng_session_ok "$SESSION_NAME" + + rm -rf "$TRACE_PATH" +} + +function test_channel_buffer_too_large() +{ + TRACE_PATH=$(mktemp -d) + SESSION_NAME="test_session_name" + CHANNEL_NAME="test_channel_name" + create_lttng_session_ok "$SESSION_NAME" "$TRACE_PATH" + + # Try to create a buffer larger than memory. This testcase will need to + # be adjusted if someone has a computer with 1024*1000 GB of ram. + lttng_enable_kernel_channel_fail "$SESSION_NAME" "$CHANNEL_NAME" --subbuf-size=1000G --num-subbuf=1024 + + destroy_lttng_session_ok "$SESSION_NAME" + + rm -rf "$TRACE_PATH" +} + +plan_tests $NUM_TESTS +print_test_banner "$TEST_DESC" + +if [ "$(id -u)" == "0" ]; then + isroot=1 +else + isroot=0 +fi + +skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || +{ + start_lttng_sessiond + + test_channel_buffer + test_channel_buffer_too_large + + stop_lttng_sessiond +}