3 # Copyright (C) 2015 Julien Desfossez <jdesfossez@efficios.com>
5 # SPDX-License-Identifier: LGPL-2.1-only
7 TEST_DESC
="Streaming - Kernel tracing"
10 TESTDIR
=$CURDIR/..
/..
/..
11 EVENT_NAME
="lttng_test_filter_event"
14 TRACE_PATH
=$
(mktemp
-d)
18 source $TESTDIR/utils
/utils.sh
20 function test_kernel_streaming
()
24 diag
"Test kernel streaming with metadata regeneration"
25 create_lttng_session_uri
$SESSION_NAME net
://localhost
26 lttng_enable_kernel_event
$SESSION_NAME $EVENT_NAME
27 start_lttng_tracing_ok
$SESSION_NAME
28 echo -n "100" > /proc
/lttng-test-filter-event
31 stop_lttng_tracing_ok
$SESSION_NAME
32 validate_trace
$EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
34 # Find the metadata file
35 metadata_path
=$
(find "$TRACE_PATH/$HOSTNAME/$SESSION_NAME"* |
grep metadata
)
37 # Empty the metadata file
38 echo -n > "$metadata_path"
40 start_lttng_tracing_ok
$SESSION_NAME
41 regenerate_metadata_ok
$SESSION_NAME
42 stop_lttng_tracing_ok
$SESSION_NAME
44 validate_trace
$EVENT_NAME $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
45 destroy_lttng_session_ok
$SESSION_NAME
49 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
59 echo -n "100" > /proc
/lttng-test-filter-event
60 stop_lttng_tracing_ok
$SESSION_NAME
61 validate_trace
$EVENT_NAME "$TRACE_PATH"
63 # Find the metadata file
64 metadata_path
=$
(find "$TRACE_PATH"* |
grep metadata
)
66 # Empty the metadata file
67 echo -n > "$metadata_path"
69 start_lttng_tracing_ok
$SESSION_NAME
70 regenerate_metadata_ok
$SESSION_NAME
71 stop_lttng_tracing_ok
$SESSION_NAME
73 validate_trace
$EVENT_NAME $TRACE_PATH
74 destroy_lttng_session_ok
$SESSION_NAME
81 print_test_banner
"$TEST_DESC"
83 if [ "$(id -u)" == "0" ]; then
89 skip
$isroot "Root access is needed. Skipping all kernel streaming tests." $NUM_TESTS ||
91 validate_lttng_modules_present
93 start_lttng_relayd
"-o $TRACE_PATH"
97 tests
=( test_kernel_streaming test_kernel_local
)
99 for fct_test
in ${tests[@]};
101 SESSION_NAME
=$
(randstring
16 0)
105 modprobe
--remove lttng-test