3 # Copyright (C) - 2019 Mathieu Desnoyers <mathieu.desnoyers@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 Base Path Override - User space tracing"
19 CURDIR
=$
(dirname "$0")/
20 TESTDIR
=$CURDIR/..
/..
/..
21 TESTAPP_PATH
="$TESTDIR/utils/testapp"
22 TESTAPP_NAME
="gen-ust-events"
23 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
24 EVENT_NAME
="tp:tptest"
26 TRACE_PATH
=$
(mktemp
-d)
30 source "$TESTDIR/utils/utils.sh"
32 if [ ! -x "$TESTAPP_BIN" ]; then
33 BAIL_OUT
"No UST events binary detected."
36 function ust_app_stream_base_path
()
38 local session_name
="ust_app_stream_base_path"
39 local base_path
="my/custom/path1"
41 diag
"Test base path override for trace streaming"
42 create_lttng_session_uri
$session_name net
://localhost
/$base_path
43 enable_ust_lttng_event_ok
$session_name $EVENT_NAME
45 start_lttng_tracing_ok
$session_name
47 $TESTAPP_BIN > /dev
/null
2>&1
49 stop_lttng_tracing_ok
$session_name
50 destroy_lttng_session_ok
$session_name
53 if validate_trace
$EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
54 # only delete if successful
59 function ust_app_snapshot_create_base_path
()
61 local session_name
="ust_app_snapshot_create_base_path"
62 local base_path
="my/custom/path2"
64 diag
"Test base path override for remote trace snapshot (URI on create)"
65 create_lttng_session_uri
$session_name net
://localhost
/$base_path \
67 enable_ust_lttng_event_ok
$session_name $EVENT_NAME
69 start_lttng_tracing_ok
$session_name
71 $TESTAPP_BIN > /dev
/null
2>&1
73 stop_lttng_tracing_ok
$session_name
75 lttng_snapshot_record
$session_name
77 destroy_lttng_session_ok
$session_name
80 if validate_trace
$EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
81 # only delete if successful
86 function ust_app_snapshot_base_path
()
88 local session_name
="ust_app_snapshot_base_path"
89 local base_path
="my/custom/path3"
91 diag
"Test base path override for remote trace snapshot (URI on snapshot)"
92 create_lttng_session_no_output
$session_name --snapshot
93 enable_ust_lttng_event_ok
$session_name $EVENT_NAME
95 start_lttng_tracing_ok
$session_name
97 $TESTAPP_BIN > /dev
/null
2>&1
99 stop_lttng_tracing_ok
$session_name
101 lttng_snapshot_record
$session_name net
://localhost
/$base_path
103 destroy_lttng_session_ok
$session_name
106 if validate_trace
$EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
107 # only delete if successful
112 function ust_app_snapshot_add_output_base_path
()
114 local session_name
="ust_app_snapshot_add_output_base_path"
115 local base_path
="my/custom/path4"
117 diag
"Test base path override for remote trace snapshot (URI on add-output)"
118 create_lttng_session_no_output
$session_name --snapshot
119 enable_ust_lttng_event_ok
$session_name $EVENT_NAME
121 start_lttng_tracing_ok
$session_name
123 $TESTAPP_BIN > /dev
/null
2>&1
125 stop_lttng_tracing_ok
$session_name
127 lttng_snapshot_add_output_ok
$session_name net
://localhost
/$base_path
128 lttng_snapshot_record
$session_name
130 destroy_lttng_session_ok
$session_name
133 if validate_trace
$EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
134 # only delete if successful
139 function ust_app_stream_base_path_via_load
()
141 local session_name
="load-stream-extra-path"
142 local base_path
="my/custom/path5"
144 diag
"Test base path override for trace streaming using lttng load"
145 lttng_load_ok
"-i $CURDIR/$session_name.lttng"
146 start_lttng_tracing_ok
$session_name
148 $TESTAPP_BIN > /dev
/null
2>&1
150 stop_lttng_tracing_ok
$session_name
151 destroy_lttng_session_ok
$session_name
154 if validate_trace
$EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
155 # only delete if successful
160 plan_tests
$NUM_TESTS
162 print_test_banner
"$TEST_DESC"
164 start_lttng_relayd
"-o $TRACE_PATH"
167 tests
=( ust_app_stream_base_path
168 ust_app_snapshot_create_base_path
169 ust_app_snapshot_base_path
170 ust_app_snapshot_add_output_base_path
171 ust_app_stream_base_path_via_load
173 for fct_test
in "${tests[@]}";