Commit | Line | Data |
---|---|---|
09b72f7a FD |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2018 Francis Deslauriers <francis.deslauriers@efficios.com> | |
4 | # | |
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. | |
8 | # | |
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 | |
12 | # more details. | |
13 | # | |
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. | |
17 | ||
18 | TEST_DESC="Kernel tracer - Channel configuration" | |
19 | ||
20 | CURDIR=$(dirname $0)/ | |
21 | TESTDIR=$CURDIR/../.. | |
22 | NUM_TESTS=8 | |
23 | ||
24 | source $TESTDIR/utils/utils.sh | |
25 | ||
26 | function test_channel_buffer() | |
27 | { | |
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" | |
32 | ||
33 | # Try to create a tiny buffer. | |
34 | lttng_enable_kernel_channel_ok "$SESSION_NAME" "$CHANNEL_NAME" --subbuf-size=4k --num-subbuf=1 | |
35 | ||
36 | destroy_lttng_session_ok "$SESSION_NAME" | |
37 | ||
38 | rm -rf "$TRACE_PATH" | |
39 | } | |
40 | ||
41 | function test_channel_buffer_too_large() | |
42 | { | |
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" | |
47 | ||
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 | |
51 | ||
52 | destroy_lttng_session_ok "$SESSION_NAME" | |
53 | ||
54 | rm -rf "$TRACE_PATH" | |
55 | } | |
56 | ||
57 | plan_tests $NUM_TESTS | |
58 | print_test_banner "$TEST_DESC" | |
59 | ||
60 | if [ "$(id -u)" == "0" ]; then | |
61 | isroot=1 | |
62 | else | |
63 | isroot=0 | |
64 | fi | |
65 | ||
66 | skip $isroot "Root access is needed. Skipping all tests." $NUM_TESTS || | |
67 | { | |
68 | start_lttng_sessiond | |
69 | ||
70 | test_channel_buffer | |
71 | test_channel_buffer_too_large | |
72 | ||
73 | stop_lttng_sessiond | |
74 | } |