be65472bae05212c6117a79245cb94a9dfe217a2
[lttng-tools.git] / tests / regression / tools / regen-statedump / test_kernel
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 SESSION_NAME=""
23 EVENT_NAME="lttng_statedump_start,lttng_statedump_end"
24
25 TRACE_PATH=$(mktemp -d)
26
27 NUM_TESTS=11
28
29 source $TESTDIR/utils/utils.sh
30
31 function test_kernel_local ()
32 {
33 diag "Test kernel local with statedump regeneration"
34 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
35 lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
36 start_lttng_tracing_ok $SESSION_NAME
37 echo -n "100" > /proc/lttng-test-filter-event
38 regenerate_statedump_ok $SESSION_NAME
39 stop_lttng_tracing_ok $SESSION_NAME
40 validate_trace_count $EVENT_NAME $TRACE_PATH 4
41 if [ $? -eq 0 ]; then
42 # Only delete if successful
43 rm -rf $TRACE_PATH
44 fi
45 destroy_lttng_session_ok $SESSION_NAME
46 }
47
48 plan_tests $NUM_TESTS
49
50 print_test_banner "$TEST_DESC"
51
52 if [ "$(id -u)" == "0" ]; then
53 isroot=1
54 else
55 isroot=0
56 fi
57
58 skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
59 {
60 validate_lttng_modules_present
61 start_lttng_sessiond
62 modprobe lttng-test
63
64 tests=( test_kernel_local )
65
66 for fct_test in ${tests[@]};
67 do
68 SESSION_NAME=$(randstring 16 0)
69 ${fct_test}
70 done
71
72 rmmod lttng-test
73 stop_lttng_sessiond
74 }
This page took 0.031772 seconds and 4 git commands to generate.