8a261355dedec3636b69e6d781bdc329a075df5a
[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 # SPDX-License-Identifier: LGPL-2.1-only
6
7 TEST_DESC="Regenerate the statedump - Kernel tracing"
8
9 CURDIR=$(dirname $0)/
10 TESTDIR=$CURDIR/../../..
11 EVENT_NAME="lttng_test_filter_event"
12 SESSION_NAME=""
13 EVENT_NAME="lttng_statedump_start,lttng_statedump_end"
14
15 TRACE_PATH=$(mktemp --tmpdir -d tmp.test_regenerate_statedump_kernel_trace_path.XXXXXX)
16
17 NUM_TESTS=11
18
19 source $TESTDIR/utils/utils.sh
20
21 function test_kernel_local ()
22 {
23 diag "Test kernel local with statedump regeneration"
24 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
25 lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
26 start_lttng_tracing_ok $SESSION_NAME
27 echo -n "100" > /proc/lttng-test-filter-event
28 regenerate_statedump_ok $SESSION_NAME
29 stop_lttng_tracing_ok $SESSION_NAME
30 validate_trace_count $EVENT_NAME $TRACE_PATH 4
31 if [ $? -eq 0 ]; then
32 # Only delete if successful
33 rm -rf $TRACE_PATH
34 fi
35 destroy_lttng_session_ok $SESSION_NAME
36 }
37
38 plan_tests $NUM_TESTS
39
40 print_test_banner "$TEST_DESC"
41
42 if [ "$(id -u)" == "0" ]; then
43 isroot=1
44 else
45 isroot=0
46 fi
47
48 skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
49 {
50 validate_lttng_modules_present
51 start_lttng_sessiond
52 modprobe lttng-test
53
54 tests=( test_kernel_local )
55
56 for fct_test in ${tests[@]};
57 do
58 SESSION_NAME=$(randstring 16 0)
59 ${fct_test}
60 done
61
62 modprobe --remove lttng-test
63 stop_lttng_sessiond
64 }
This page took 0.047792 seconds and 5 git commands to generate.