3 # Copyright (C) 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
5 # SPDX-License-Identifier: GPL-2.0-only
8 TEST_DESC
="Kernel tracer - Channel configuration"
14 source $TESTDIR/utils
/utils.sh
16 function test_channel_buffer
()
18 TRACE_PATH
=$
(mktemp
--tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
19 SESSION_NAME
="test_session_name"
20 CHANNEL_NAME
="test_channel_name"
21 create_lttng_session_ok
"$SESSION_NAME" "$TRACE_PATH"
23 # Try to create a tiny buffer.
24 lttng_enable_kernel_channel_ok
"$SESSION_NAME" "$CHANNEL_NAME" --subbuf-size=4k
--num-subbuf=1
26 destroy_lttng_session_ok
"$SESSION_NAME"
31 function test_channel_buffer_too_large
()
33 TRACE_PATH
=$
(mktemp
--tmpdir -d "tmp.${FUNCNAME[0]}_trace_path.XXXXXX")
34 SESSION_NAME
="test_session_name"
35 CHANNEL_NAME
="test_channel_name"
36 create_lttng_session_ok
"$SESSION_NAME" "$TRACE_PATH"
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
42 destroy_lttng_session_ok
"$SESSION_NAME"
48 print_test_banner
"$TEST_DESC"
50 if [ "$(id -u)" == "0" ]; then
56 skip
$isroot "Root access is needed. Skipping all tests." $NUM_TESTS ||
61 test_channel_buffer_too_large