Commit | Line | Data |
---|---|---|
54cd6107 JD |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2016 Julien Desfossez <jdesfossez@efficios.com> | |
4 | # | |
5 | # This library is free software; you can redistribute it and/or modify it under | |
6 | # the terms of the GNU Lesser General Public License as published by the Free | |
7 | # Software Foundation; version 2.1 of the License. | |
8 | # | |
9 | # This library is distributed in the hope that it will be useful, but WITHOUT | |
10 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | |
11 | # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | |
12 | # details. | |
13 | # | |
14 | # You should have received a copy of the GNU Lesser General Public License | |
15 | # along with this library; if not, write to the Free Software Foundation, Inc., | |
16 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | TEST_DESC="Regenerate the statedump - Kernel tracing" | |
18 | ||
19 | CURDIR=$(dirname $0)/ | |
20 | TESTDIR=$CURDIR/../../.. | |
21 | EVENT_NAME="lttng_test_filter_event" | |
22 | PID_RELAYD=0 | |
23 | SESSION_NAME="" | |
24 | EVENT_NAME="lttng_statedump_start,lttng_statedump_end" | |
25 | ||
26 | TRACE_PATH=$(mktemp -d) | |
27 | ||
28 | NUM_TESTS=11 | |
29 | ||
30 | source $TESTDIR/utils/utils.sh | |
31 | ||
54cd6107 JD |
32 | function test_kernel_local () |
33 | { | |
34 | diag "Test kernel local with statedump regeneration" | |
35 | create_lttng_session_ok $SESSION_NAME $TRACE_PATH | |
36 | lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME | |
37 | start_lttng_tracing_ok $SESSION_NAME | |
38 | echo -n "100" > /proc/lttng-test-filter-event | |
39 | regenerate_statedump_ok $SESSION_NAME | |
40 | stop_lttng_tracing_ok $SESSION_NAME | |
41 | validate_trace_count $EVENT_NAME $TRACE_PATH 4 | |
42 | if [ $? -eq 0 ]; then | |
43 | # Only delete if successful | |
44 | rm -rf $TRACE_PATH | |
45 | fi | |
46 | destroy_lttng_session_ok $SESSION_NAME | |
47 | } | |
48 | ||
49 | plan_tests $NUM_TESTS | |
50 | ||
51 | print_test_banner "$TEST_DESC" | |
52 | ||
53 | if [ "$(id -u)" == "0" ]; then | |
54 | isroot=1 | |
55 | else | |
56 | isroot=0 | |
57 | fi | |
58 | ||
59 | skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS || | |
60 | { | |
f637036a | 61 | validate_lttng_modules_present |
54cd6107 JD |
62 | start_lttng_sessiond |
63 | modprobe lttng-test | |
64 | ||
65 | tests=( test_kernel_local ) | |
66 | ||
67 | for fct_test in ${tests[@]}; | |
68 | do | |
69 | SESSION_NAME=$(randstring 16 0) | |
70 | ${fct_test} | |
71 | done | |
72 | ||
73 | rmmod lttng-test | |
74 | stop_lttng_sessiond | |
75 | } |