Tests: base path: lttng load for session configuration
[lttng-tools.git] / tests / regression / tools / base-path / test_ust
1 #!/bin/bash
2 #
3 # Copyright (C) - 2019 Mathieu Desnoyers <mathieu.desnoyers@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
17 TEST_DESC="Streaming Base Path Override - User space tracing"
18
19 CURDIR=$(dirname $0)/
20 TESTDIR=$CURDIR/../../..
21 NR_ITER=5
22 NR_USEC_WAIT=0
23 TESTAPP_PATH="$TESTDIR/utils/testapp"
24 TESTAPP_NAME="gen-ust-events"
25 TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
26 EVENT_NAME="tp:tptest"
27
28 TRACE_PATH=$(mktemp -d)
29
30 NUM_TESTS=37
31
32 source $TESTDIR/utils/utils.sh
33
34 if [ ! -x "$TESTAPP_BIN" ]; then
35 BAIL_OUT "No UST events binary detected."
36 fi
37
38 function ust_app_stream_base_path ()
39 {
40 local session_name=$(randstring 16 0)
41 local base_path="my/custom/path1"
42
43 diag "Test base path override for trace streaming"
44 create_lttng_session_uri $session_name net://localhost/$base_path
45 enable_ust_lttng_event_ok $session_name $EVENT_NAME
46
47 start_lttng_tracing_ok $session_name
48
49 $TESTAPP_BIN > /dev/null 2>&1
50
51 stop_lttng_tracing_ok $session_name
52 destroy_lttng_session_ok $session_name
53
54 # validate test
55 validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
56 if [ $? -eq 0 ]; then
57 # only delete if successful
58 rm -rf $TRACE_PATH
59 fi
60 }
61
62 function ust_app_snapshot_create_base_path ()
63 {
64 local session_name=$(randstring 16 0)
65 local base_path="my/custom/path2"
66
67 diag "Test base path override for remote trace snapshot (URI on create)"
68 create_lttng_session_uri $session_name net://localhost/$base_path \
69 --snapshot
70 enable_ust_lttng_event_ok $session_name $EVENT_NAME
71
72 start_lttng_tracing_ok $session_name
73
74 $TESTAPP_BIN > /dev/null 2>&1
75
76 stop_lttng_tracing_ok $session_name
77
78 lttng_snapshot_record $session_name
79
80 destroy_lttng_session_ok $session_name
81
82 # validate test
83 validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
84 if [ $? -eq 0 ]; then
85 # only delete if successful
86 rm -rf $TRACE_PATH
87 fi
88 }
89
90 function ust_app_snapshot_base_path ()
91 {
92 local session_name=$(randstring 16 0)
93 local base_path="my/custom/path3"
94
95 diag "Test base path override for remote trace snapshot (URI on snapshot)"
96 create_lttng_session_no_output $session_name --snapshot
97 enable_ust_lttng_event_ok $session_name $EVENT_NAME
98
99 start_lttng_tracing_ok $session_name
100
101 $TESTAPP_BIN > /dev/null 2>&1
102
103 stop_lttng_tracing_ok $session_name
104
105 lttng_snapshot_record $session_name net://localhost/$base_path
106
107 destroy_lttng_session_ok $session_name
108
109 # validate test
110 validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
111 if [ $? -eq 0 ]; then
112 # only delete if successful
113 rm -rf $TRACE_PATH
114 fi
115 }
116
117 function ust_app_snapshot_add_output_base_path ()
118 {
119 local session_name=$(randstring 16 0)
120 local base_path="my/custom/path4"
121
122 diag "Test base path override for remote trace snapshot (URI on add-output)"
123 create_lttng_session_no_output $session_name --snapshot
124 enable_ust_lttng_event_ok $session_name $EVENT_NAME
125
126 start_lttng_tracing_ok $session_name
127
128 $TESTAPP_BIN > /dev/null 2>&1
129
130 stop_lttng_tracing_ok $session_name
131
132 lttng_snapshot_add_output_ok $session_name net://localhost/$base_path
133 lttng_snapshot_record $session_name
134
135 destroy_lttng_session_ok $session_name
136
137 # validate test
138 validate_trace $EVENT_NAME $TRACE_PATH/$HOSTNAME/$base_path
139 if [ $? -eq 0 ]; then
140 # only delete if successful
141 rm -rf $TRACE_PATH
142 fi
143 }
144
145 function ust_app_stream_base_path_via_load ()
146 {
147 local session_name="load-stream-extra-path"
148 local base_path="my/custom/path5"
149
150 diag "Test base path override for trace streaming using lttng load"
151 lttng_load_ok "-i $CURDIR/$session_name.lttng"
152 start_lttng_tracing_ok $session_name
153
154 $TESTAPP_BIN > /dev/null 2>&1
155
156 stop_lttng_tracing_ok $session_name
157 destroy_lttng_session_ok $session_name
158
159 # validate test
160 if validate_trace $EVENT_NAME "$TRACE_PATH/$HOSTNAME/$base_path"; then
161 # only delete if successful
162 rm -rf "$TRACE_PATH"
163 fi
164 }
165
166 plan_tests $NUM_TESTS
167
168 print_test_banner "$TEST_DESC"
169
170 start_lttng_relayd "-o $TRACE_PATH"
171 start_lttng_sessiond
172
173 tests=( ust_app_stream_base_path
174 ust_app_snapshot_create_base_path
175 ust_app_snapshot_base_path
176 ust_app_snapshot_add_output_base_path
177 ust_app_stream_base_path_via_load
178 )
179 for fct_test in ${tests[@]};
180 do
181 ${fct_test}
182 done
183
184 stop_lttng_sessiond
185 stop_lttng_relayd
This page took 0.048837 seconds and 4 git commands to generate.