3 # Copyright (C) - 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
5 # This program is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License, version 2 only, as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it will be useful, but WITHOUT
10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 # You should have received a copy of the GNU General Public License along with
15 # this program; if not, write to the Free Software Foundation, Inc., 51
16 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 TEST_DESC
="Kernel tracer - Channel configuration"
24 source $TESTDIR/utils
/utils.sh
26 function test_channel_buffer
()
28 TRACE_PATH
=$
(mktemp
-d)
29 SESSION_NAME
="test_session_name"
30 CHANNEL_NAME
="test_channel_name"
31 create_lttng_session_ok
"$SESSION_NAME" "$TRACE_PATH"
33 # Try to create a tiny buffer.
34 lttng_enable_kernel_channel_ok
"$SESSION_NAME" "$CHANNEL_NAME" --subbuf-size=4k
--num-subbuf=1
36 destroy_lttng_session_ok
"$SESSION_NAME"
41 function test_channel_buffer_too_large
()
43 TRACE_PATH
=$
(mktemp
-d)
44 SESSION_NAME
="test_session_name"
45 CHANNEL_NAME
="test_channel_name"
46 create_lttng_session_ok
"$SESSION_NAME" "$TRACE_PATH"
48 # Try to create a buffer larger than memory. This testcase will need to
49 # be adjusted if someone has a computer with 1024*1000 GB of ram.
50 lttng_enable_kernel_channel_fail
"$SESSION_NAME" "$CHANNEL_NAME" --subbuf-size=1000G
--num-subbuf=1024
52 destroy_lttng_session_ok
"$SESSION_NAME"
58 print_test_banner
"$TEST_DESC"
60 if [ "$(id -u)" == "0" ]; then
66 skip
$isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
71 test_channel_buffer_too_large