Tests: missing license header in rotation utils
[lttng-tools.git] / tests / regression / tools / regen-statedump / test_kernel
CommitLineData
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
17TEST_DESC="Regenerate the statedump - Kernel tracing"
18
19CURDIR=$(dirname $0)/
20TESTDIR=$CURDIR/../../..
21EVENT_NAME="lttng_test_filter_event"
22PID_RELAYD=0
23SESSION_NAME=""
24EVENT_NAME="lttng_statedump_start,lttng_statedump_end"
25
26TRACE_PATH=$(mktemp -d)
27
28NUM_TESTS=11
29
30source $TESTDIR/utils/utils.sh
31
32# LTTng kernel modules check
33out=`ls /lib/modules/$(uname -r)/extra | grep lttng`
34if [ -z "$out" ]; then
35 BAIL_OUT "LTTng modules not detected."
36fi
37
38function test_kernel_local ()
39{
40 diag "Test kernel local with statedump regeneration"
41 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
42 lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
43 start_lttng_tracing_ok $SESSION_NAME
44 echo -n "100" > /proc/lttng-test-filter-event
45 regenerate_statedump_ok $SESSION_NAME
46 stop_lttng_tracing_ok $SESSION_NAME
47 validate_trace_count $EVENT_NAME $TRACE_PATH 4
48 if [ $? -eq 0 ]; then
49 # Only delete if successful
50 rm -rf $TRACE_PATH
51 fi
52 destroy_lttng_session_ok $SESSION_NAME
53}
54
55plan_tests $NUM_TESTS
56
57print_test_banner "$TEST_DESC"
58
59if [ "$(id -u)" == "0" ]; then
60 isroot=1
61else
62 isroot=0
63fi
64
65skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
66{
67 start_lttng_sessiond
68 modprobe lttng-test
69
70 tests=( test_kernel_local )
71
72 for fct_test in ${tests[@]};
73 do
74 SESSION_NAME=$(randstring 16 0)
75 ${fct_test}
76 done
77
78 rmmod lttng-test
79 stop_lttng_sessiond
80}
This page took 0.030492 seconds and 4 git commands to generate.