Commit | Line | Data |
---|---|---|
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 | |
8 | TEST_DESC="Kernel tracer - Channel configuration" | |
9 | ||
10 | CURDIR=$(dirname $0)/ | |
11 | TESTDIR=$CURDIR/../.. | |
12 | NUM_TESTS=8 | |
13 | ||
14 | source $TESTDIR/utils/utils.sh | |
15 | ||
16 | function 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 | ||
31 | function 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 | ||
47 | plan_tests $NUM_TESTS | |
48 | print_test_banner "$TEST_DESC" | |
49 | ||
50 | if [ "$(id -u)" == "0" ]; then | |
51 | isroot=1 | |
52 | else | |
53 | isroot=0 | |
54 | fi | |
55 | ||
56 | skip $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 | } |