3 # Copyright (C) - 2015 Julien Desfossez <jdesfossez@efficios.com>
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.
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
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
="Streaming - Kernel tracing"
20 TESTDIR
=$CURDIR/..
/..
/..
21 EVENT_NAME
="lttng_test_filter_event"
25 TRACE_PATH
=$
(mktemp
-d)
29 source $TESTDIR/utils
/utils.sh
31 function test_kernel_streaming
()
33 diag
"Test kernel streaming with metadata regeneration"
34 create_lttng_session_uri
$SESSION_NAME net
://localhost
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_metadata_ok
$SESSION_NAME
39 stop_lttng_tracing_ok
$SESSION_NAME
41 validate_trace
$EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
43 # Only delete if successful
48 destroy_lttng_session_ok
$SESSION_NAME
51 function test_kernel_local
()
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
58 regenerate_metadata_ok
$SESSION_NAME
59 stop_lttng_tracing_ok
$SESSION_NAME
60 validate_trace
$EVENT_NAME $TRACE_PATH
62 # Only delete if successful
65 destroy_lttng_session_ok
$SESSION_NAME
70 print_test_banner
"$TEST_DESC"
72 if [ "$(id -u)" == "0" ]; then
78 skip
$isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
80 validate_lttng_modules_present
82 start_lttng_relayd
"-o $TRACE_PATH"
86 tests
=( test_kernel_streaming test_kernel_local
)
88 for fct_test
in ${tests[@]};
90 SESSION_NAME
=$
(randstring
16 0)