Tests: consolidate session creation with a uri parameter in utils.sh
[lttng-tools.git] / tests / regression / tools / regen-metadata / test_kernel
CommitLineData
801236b0
JD
1#!/bin/bash
2#
3# Copyright (C) - 2015 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="Streaming - Kernel tracing"
18
19CURDIR=$(dirname $0)/
20TESTDIR=$CURDIR/../../..
21EVENT_NAME="lttng_test_filter_event"
22PID_RELAYD=0
23SESSION_NAME=""
24
25TRACE_PATH=$(mktemp -d)
26
27NUM_TESTS=18
28
29source $TESTDIR/utils/utils.sh
30
801236b0
JD
31function test_kernel_streaming ()
32{
33 diag "Test kernel streaming with metadata regeneration"
f0d43d3d 34 create_lttng_session_uri $SESSION_NAME net://localhost
801236b0
JD
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
eded6438 38 regenerate_metadata_ok $SESSION_NAME
801236b0
JD
39 stop_lttng_tracing_ok $SESSION_NAME
40 # Validate test
41 validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
42 if [ $? -eq 0 ]; then
43 # Only delete if successful
44 rm -rf $TRACE_PATH
45 else
46 break
47 fi
48 destroy_lttng_session_ok $SESSION_NAME
49}
50
51function test_kernel_local ()
52{
53 diag "Test kernel local with metadata regeneration"
54 create_lttng_session_ok $SESSION_NAME $TRACE_PATH
55 lttng_enable_kernel_event $SESSION_NAME $EVENT_NAME
56 start_lttng_tracing_ok $SESSION_NAME
57 echo -n "100" > /proc/lttng-test-filter-event
eded6438 58 regenerate_metadata_ok $SESSION_NAME
801236b0
JD
59 stop_lttng_tracing_ok $SESSION_NAME
60 validate_trace $EVENT_NAME $TRACE_PATH
61 if [ $? -eq 0 ]; then
62 # Only delete if successful
63 rm -rf $TRACE_PATH
64 fi
65 destroy_lttng_session_ok $SESSION_NAME
66}
67
68plan_tests $NUM_TESTS
69
70print_test_banner "$TEST_DESC"
71
72if [ "$(id -u)" == "0" ]; then
73 isroot=1
74else
75 isroot=0
76fi
77
78skip $isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
79{
9c8a3964
JR
80 validate_lttng_modules_present
81
801236b0
JD
82 start_lttng_relayd "-o $TRACE_PATH"
83 start_lttng_sessiond
84 modprobe lttng-test
85
86 tests=( test_kernel_streaming test_kernel_local )
87
88 for fct_test in ${tests[@]};
89 do
90 SESSION_NAME=$(randstring 16 0)
91 ${fct_test}
92 done
93
94 rmmod lttng-test
95 stop_lttng_sessiond
96 stop_lttng_relayd
97}
This page took 0.028787 seconds and 4 git commands to generate.