Commit | Line | Data |
---|---|---|
629d89b9 JR |
1 | #!/bin/bash |
2 | # | |
3 | # Copyright (C) - 2018 Jonathan Rajotte <jonathan.rajotte-julien@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 | ||
18 | TEST_DESC="LTTng relayd filesystem grouping - Userspace tracing" | |
19 | ||
20 | CURDIR=$(dirname $0)/ | |
21 | TESTDIR=$CURDIR/../../.. | |
22 | NR_ITER=10 | |
23 | NR_USEC_WAIT=100 | |
24 | TESTAPP_PATH="$TESTDIR/utils/testapp" | |
25 | TESTAPP_NAME="gen-ust-events" | |
26 | TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" | |
27 | EVENT_NAME="tp:tptest" | |
28 | ||
07334a07 | 29 | XSD_PATH=$TESTDIR/../src/common/mi-lttng-4.0.xsd |
629d89b9 JR |
30 | |
31 | XML_VALIDATE="$TESTDIR/regression/tools/mi/validate_xml $XSD_PATH" | |
32 | XML_EXTRACT="$TESTDIR/regression/tools/mi/extract_xml" | |
33 | ||
34 | XPATH_CMD_OUTPUT="//lttng:command/lttng:output" | |
35 | XPATH_SESSION="$XPATH_CMD_OUTPUT/lttng:sessions/lttng:session" | |
36 | ||
37 | TRACE_PATH=$(mktemp -d) | |
38 | ||
39 | NUM_TESTS=229 | |
40 | ||
41 | source $TESTDIR/utils/utils.sh | |
42 | ||
43 | if [ ! -x "$TESTAPP_BIN" ]; then | |
44 | BAIL_OUT "No UST events binary detected." | |
45 | fi | |
46 | ||
47 | function get_auto_session_name () | |
48 | { | |
49 | local __result=$1 | |
50 | ||
51 | LTTNG_BIN="lttng --mi xml" | |
52 | OUTPUT_DEST=$(mktemp -u) | |
53 | ||
54 | list_lttng_with_opts | |
55 | $XML_VALIDATE ${OUTPUT_DEST} | |
56 | ok $? "Valid lttng list XML" | |
57 | ||
58 | value=$($XML_EXTRACT ${OUTPUT_DEST} ${XPATH_SESSION}/lttng:name/text\(\)) | |
59 | ok $? "Extraction of session name" | |
60 | OUTPUT_DEST=/dev/null | |
61 | LTTNG_BIN="lttng" | |
62 | ||
63 | eval $__result="'$value'" | |
64 | } | |
65 | ||
66 | function test_ust_uid_live_automatic_name () | |
67 | { | |
68 | local session_name="$1" | |
69 | local channel_name=$(randstring 8 0) | |
70 | local is_automatic_session=false | |
71 | ||
72 | if [ -z "$session_name" ]; then | |
73 | is_automatic_session=true | |
74 | fi | |
75 | ||
76 | diag "Test UST uid buffer live with session name" | |
77 | ||
78 | create_lttng_session_uri "$session_name" net://localhost --live | |
79 | ||
80 | if [ "$is_automatic_session" = true ]; then | |
81 | get_auto_session_name session_name | |
82 | fi | |
83 | ||
84 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-uid" | |
85 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
86 | start_lttng_tracing_ok $session_name | |
87 | ||
88 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
89 | ||
90 | stop_lttng_tracing_ok $session_name | |
91 | destroy_lttng_session_ok $session_name | |
92 | ||
93 | # When session name is automatic, the actual directory is "auto", not | |
94 | # auto-<datetime>. | |
95 | if [ "$is_automatic_session" = true ]; then | |
96 | session_name="auto" | |
97 | fi | |
98 | ||
99 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME* | |
100 | set +x | |
101 | } | |
102 | ||
103 | function test_ust_uid_live () | |
104 | { | |
105 | local session_name="$1" | |
106 | local channel_name=$(randstring 8 0) | |
107 | local is_automatic_session=false | |
108 | ||
109 | if [ -z "$session_name" ]; then | |
110 | is_automatic_session=true | |
111 | fi | |
112 | ||
113 | diag "Test UST uid buffer live with session name" | |
114 | ||
115 | create_lttng_session_uri "$session_name" net://localhost --live | |
116 | if [ "$is_automatic_session" = true ]; then | |
117 | get_auto_session_name session_name | |
118 | fi | |
119 | ||
120 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-uid" | |
121 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
122 | start_lttng_tracing_ok $session_name | |
123 | ||
124 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
125 | ||
126 | stop_lttng_tracing_ok $session_name | |
127 | destroy_lttng_session_ok $session_name | |
128 | ||
129 | # When session name is automatic, the actual directory is "auto", not | |
130 | # auto-<datetime>. | |
131 | if [ "$is_automatic_session" = true ]; then | |
132 | session_name="auto" | |
133 | fi | |
134 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME* | |
135 | } | |
136 | ||
137 | function test_ust_pid_live () | |
138 | { | |
139 | local session_name="$1" | |
140 | local channel_name=$(randstring 8 0) | |
141 | local is_automatic_session=false | |
142 | ||
143 | if [ -z "$session_name" ]; then | |
144 | is_automatic_session=true | |
145 | fi | |
146 | ||
147 | diag "Test UST pid buffer live with session name" | |
148 | ||
149 | create_lttng_session_uri "$session_name" net://localhost --live | |
150 | if [ "$is_automatic_session" = true ]; then | |
151 | get_auto_session_name session_name | |
152 | fi | |
153 | ||
154 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-pid" | |
155 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
156 | start_lttng_tracing_ok $session_name | |
157 | ||
158 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
159 | ||
160 | stop_lttng_tracing_ok $session_name | |
161 | destroy_lttng_session_ok $session_name | |
162 | ||
163 | # When session name is automatic, the actual directory is "auto", not | |
164 | # auto-<datetime>. | |
165 | if [ "$is_automatic_session" = true ]; then | |
166 | session_name="auto" | |
167 | fi | |
168 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME* | |
169 | } | |
170 | ||
171 | function test_ust_uid_live_custom_output () | |
172 | { | |
173 | local session_name="$1" | |
174 | local channel_name=$(randstring 8 0) | |
175 | local custom_output="my_live_custom_output" | |
176 | local is_automatic_session=false | |
177 | ||
178 | if [ -z "$session_name" ]; then | |
179 | is_automatic_session=true | |
180 | fi | |
181 | ||
182 | diag "Test UST uid buffer live with session name, custom output" | |
183 | ||
184 | create_lttng_session_uri "$session_name" net://localhost/$custom_output --live | |
185 | if [ "$is_automatic_session" = true ]; then | |
186 | get_auto_session_name session_name | |
187 | fi | |
188 | ||
189 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-uid" | |
190 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
191 | start_lttng_tracing_ok $session_name | |
192 | ||
193 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
194 | ||
195 | stop_lttng_tracing_ok $session_name | |
196 | destroy_lttng_session_ok $session_name | |
197 | ||
198 | # When session name is automatic, the actual directory is "auto", not | |
199 | # auto-<datetime>. | |
200 | if [ "$is_automatic_session" = true ]; then | |
201 | session_name="auto" | |
202 | fi | |
203 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output | |
204 | } | |
205 | ||
206 | function test_ust_uid_streaming () | |
207 | { | |
208 | local session_name="$1" | |
209 | local channel_name=$(randstring 8 0) | |
210 | local is_automatic_session=false | |
211 | ||
212 | if [ -z "$session_name" ]; then | |
213 | is_automatic_session=true | |
214 | fi | |
215 | ||
216 | diag "Test UST uid buffer streaming with session name" | |
217 | ||
218 | create_lttng_session_uri "$session_name" net://localhost | |
219 | if [ "$is_automatic_session" = true ]; then | |
220 | get_auto_session_name session_name | |
221 | fi | |
222 | ||
223 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-uid" | |
224 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
225 | start_lttng_tracing_ok $session_name | |
226 | ||
227 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
228 | ||
229 | stop_lttng_tracing_ok $session_name | |
230 | destroy_lttng_session_ok $session_name | |
231 | ||
232 | # When session name is automatic, the actual directory is "auto", not | |
233 | # auto-<datetime>. | |
234 | if [ "$is_automatic_session" = true ]; then | |
235 | session_name="auto" | |
236 | fi | |
237 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME* | |
238 | } | |
239 | ||
240 | function test_ust_pid_streaming () | |
241 | { | |
242 | local session_name="$1" | |
243 | local channel_name=$(randstring 8 0) | |
244 | local is_automatic_session=false | |
245 | ||
246 | if [ -z "$session_name" ]; then | |
247 | is_automatic_session=true | |
248 | fi | |
249 | ||
250 | diag "Test UST pid buffer streaming with session name" | |
251 | ||
252 | create_lttng_session_uri "$session_name" net://localhost | |
253 | if [ "$is_automatic_session" = true ]; then | |
254 | get_auto_session_name session_name | |
255 | fi | |
256 | ||
257 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-pid" | |
258 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
259 | start_lttng_tracing_ok $session_name | |
260 | ||
261 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
262 | ||
263 | stop_lttng_tracing_ok $session_name | |
264 | destroy_lttng_session_ok $session_name | |
265 | ||
266 | # When session name is automatic, the actual directory is "auto", not | |
267 | # auto-<datetime>. | |
268 | if [ "$is_automatic_session" = true ]; then | |
269 | session_name="auto" | |
270 | fi | |
271 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME* | |
272 | } | |
273 | ||
274 | function test_ust_uid_streaming_custom_output () | |
275 | { | |
276 | local session_name="$1" | |
277 | local channel_name=$(randstring 8 0) | |
278 | local custom_output="custom_second_token" | |
279 | local is_automatic_session=false | |
280 | ||
281 | if [ -z "$session_name" ]; then | |
282 | is_automatic_session=true | |
283 | fi | |
284 | ||
285 | diag "Test UST uid buffer streaming with session name, custom output" | |
286 | ||
287 | create_lttng_session_uri "$session_name" net://localhost/$custom_output | |
288 | if [ "$is_automatic_session" = true ]; then | |
289 | get_auto_session_name session_name | |
290 | fi | |
291 | ||
292 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-uid" | |
293 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
294 | start_lttng_tracing_ok $session_name | |
295 | ||
296 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
297 | ||
298 | stop_lttng_tracing_ok $session_name | |
299 | destroy_lttng_session_ok $session_name | |
300 | ||
301 | # When session name is automatic, the actual directory is "auto", not | |
302 | # auto-<datetime>. | |
303 | if [ "$is_automatic_session" = true ]; then | |
304 | session_name="auto" | |
305 | fi | |
306 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output | |
307 | } | |
308 | ||
309 | function test_ust_uid_streaming_rotate () | |
310 | { | |
311 | local session_name="$1" | |
312 | local channel_name=$(randstring 8 0) | |
313 | local is_automatic_session=false | |
314 | ||
315 | if [ -z "$session_name" ]; then | |
316 | is_automatic_session=true | |
317 | fi | |
318 | ||
319 | diag "Test UST uid buffer rotate with session name" | |
320 | ||
321 | create_lttng_session_uri "$session_name" net://localhost | |
322 | if [ "$is_automatic_session" = true ]; then | |
323 | get_auto_session_name session_name | |
324 | fi | |
325 | ||
326 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-uid" | |
327 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
328 | start_lttng_tracing_ok $session_name | |
329 | ||
330 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
331 | rotate_session_ok $session_name | |
332 | ||
333 | stop_lttng_tracing_ok $session_name | |
334 | destroy_lttng_session_ok $session_name | |
335 | ||
336 | # When session name is automatic, the actual directory is "auto", not | |
337 | # auto-<datetime>. | |
338 | if [ "$is_automatic_session" = true ]; then | |
339 | session_name="auto" | |
340 | fi | |
341 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME* | |
342 | } | |
343 | ||
344 | function test_ust_uid_streaming_rotate_custom_output () | |
345 | { | |
346 | local session_name="$1" | |
347 | local channel_name=$(randstring 8 0) | |
348 | local custom_output="rotate_custom_path" | |
349 | local is_automatic_session=false | |
350 | ||
351 | if [ -z "$session_name" ]; then | |
352 | is_automatic_session=true | |
353 | fi | |
354 | ||
355 | diag "Test UST uid buffer rotate with session name, custom output" | |
356 | ||
357 | create_lttng_session_uri "$session_name" net://localhost/$custom_output | |
358 | if [ "$is_automatic_session" = true ]; then | |
359 | get_auto_session_name session_name | |
360 | fi | |
361 | ||
362 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-uid" | |
363 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
364 | start_lttng_tracing_ok $session_name | |
365 | ||
366 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
367 | rotate_session_ok $session_name | |
368 | ||
369 | ||
370 | stop_lttng_tracing_ok $session_name | |
371 | destroy_lttng_session_ok $session_name | |
372 | ||
373 | # When session name is automatic, the actual directory is "auto", not | |
374 | # auto-<datetime>. | |
375 | if [ "$is_automatic_session" = true ]; then | |
376 | session_name="auto" | |
377 | fi | |
378 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output | |
379 | } | |
380 | ||
381 | function test_ust_pid_streaming_rotate () | |
382 | { | |
383 | local session_name="$1" | |
384 | local channel_name=$(randstring 8 0) | |
385 | local is_automatic_session=false | |
386 | ||
387 | if [ -z "$session_name" ]; then | |
388 | is_automatic_session=true | |
389 | fi | |
390 | ||
391 | diag "Test UST pid buffer rotate with session_name" | |
392 | ||
393 | create_lttng_session_uri "$session_name" net://localhost | |
394 | if [ "$is_automatic_session" = true ]; then | |
395 | get_auto_session_name session_name | |
396 | fi | |
397 | ||
398 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-pid" | |
399 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
400 | start_lttng_tracing_ok $session_name | |
401 | ||
402 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
403 | rotate_session_ok $session_name | |
404 | ||
405 | stop_lttng_tracing_ok $session_name | |
406 | destroy_lttng_session_ok $session_name | |
407 | ||
408 | # When session name is automatic, the actual directory is "auto", not | |
409 | # auto-<datetime>. | |
410 | if [ "$is_automatic_session" = true ]; then | |
411 | session_name="auto" | |
412 | fi | |
413 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME* | |
414 | } | |
415 | ||
416 | function test_ust_uid_streaming_snapshot () | |
417 | { | |
418 | local session_name="$1" | |
419 | local channel_name=$(randstring 8 0) | |
420 | local is_automatic_session=false | |
421 | ||
422 | if [ -z "$session_name" ]; then | |
423 | is_automatic_session=true | |
424 | fi | |
425 | ||
426 | diag "Test UST uid buffer snapshot streaming with session name using 'create --snapshot'" | |
427 | ||
428 | create_lttng_session_uri "$session_name" net://localhost --snapshot | |
429 | if [ "$is_automatic_session" = true ]; then | |
430 | get_auto_session_name session_name | |
431 | fi | |
432 | ||
433 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-uid" | |
434 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
435 | start_lttng_tracing_ok $session_name | |
436 | ||
437 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
438 | lttng_snapshot_record $session_name | |
439 | ||
440 | stop_lttng_tracing_ok $session_name | |
441 | destroy_lttng_session_ok $session_name | |
442 | ||
443 | # When session name is automatic, the actual directory is "auto", not | |
444 | # auto-<datetime>. | |
445 | if [ "$is_automatic_session" = true ]; then | |
446 | session_name="auto" | |
447 | fi | |
448 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME* | |
449 | } | |
450 | ||
451 | function test_ust_pid_streaming_snapshot () | |
452 | { | |
453 | local session_name="$1" | |
454 | local channel_name=$(randstring 8 0) | |
455 | local file_sync_after_first=$(mktemp -u) | |
456 | local file_sync_before_last=$(mktemp -u) | |
457 | local is_automatic_session=false | |
458 | ||
459 | if [ -z "$session_name" ]; then | |
460 | is_automatic_session=true | |
461 | fi | |
462 | ||
463 | diag "Test UST pid buffer snapshot streaming with session name using 'create --snapshot'" | |
464 | ||
465 | create_lttng_session_uri "$session_name" net://localhost --snapshot | |
466 | if [ "$is_automatic_session" = true ]; then | |
467 | get_auto_session_name session_name | |
468 | fi | |
469 | ||
470 | enable_ust_lttng_channel_ok $session_name $channel_name "--buffers-pid" | |
471 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
472 | start_lttng_tracing_ok $session_name | |
473 | ||
474 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT ${file_sync_after_first} ${file_sync_before_last} /dev/null 2>&1 & | |
475 | ||
476 | while [ ! -f "${file_sync_after_first}" ]; do | |
477 | sleep 0.5 | |
478 | done | |
479 | ||
480 | lttng_snapshot_record $session_name | |
481 | ||
482 | touch ${file_sync_before_last} | |
483 | wait | |
484 | ||
485 | stop_lttng_tracing_ok $session_name | |
486 | destroy_lttng_session_ok $session_name | |
487 | ||
488 | # When session name is automatic, the actual directory is "auto", not | |
489 | # auto-<datetime>. | |
490 | if [ "$is_automatic_session" = true ]; then | |
491 | session_name="auto" | |
492 | fi | |
493 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/snapshot-1* | |
494 | ||
495 | rm -rf ${file_sync_after_first} | |
496 | rm -rf ${file_sync_before_last} | |
497 | } | |
498 | ||
499 | function test_ust_uid_streaming_snapshot_add_output_default_name () | |
500 | { | |
501 | local session_name="$1" | |
502 | local channel_name=$(randstring 8 0) | |
503 | local is_automatic_session=false | |
504 | ||
505 | if [ -z "$session_name" ]; then | |
506 | is_automatic_session=true | |
507 | fi | |
508 | ||
509 | diag "Test UST uid buffer snapshot using 'add-output' with default snapshot name" | |
510 | ||
511 | create_lttng_session_no_output "$session_name" | |
512 | if [ "$is_automatic_session" = true ]; then | |
513 | get_auto_session_name session_name | |
514 | fi | |
515 | ||
516 | enable_lttng_mmap_overwrite_ust_channel $session_name $channel_name | |
517 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
518 | start_lttng_tracing_ok $session_name | |
519 | ||
520 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
521 | ||
522 | lttng_snapshot_add_output_ok $session_name "net://localhost" | |
523 | lttng_snapshot_record $session_name | |
524 | ||
525 | stop_lttng_tracing_ok $session_name | |
526 | destroy_lttng_session_ok $session_name | |
527 | ||
528 | # When session name is automatic, the actual directory is "auto", not | |
529 | # auto-<datetime>. | |
530 | if [ "$is_automatic_session" = true ]; then | |
531 | session_name="auto" | |
532 | fi | |
533 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/snapshot-1* | |
534 | } | |
535 | ||
536 | function test_ust_uid_streaming_snapshot_add_output_custom_name () | |
537 | { | |
538 | local session_name="$1" | |
539 | local channel_name=$(randstring 8 0) | |
540 | local snapshot_name="this_is_my_snapshot" | |
541 | local is_automatic_session=false | |
542 | ||
543 | if [ -z "$session_name" ]; then | |
544 | is_automatic_session=true | |
545 | fi | |
546 | ||
547 | diag "Test UST uid buffer snapshot using 'add-output' with custom snapshot name" | |
548 | ||
549 | create_lttng_session_no_output "$session_name" | |
550 | if [ "$is_automatic_session" = true ]; then | |
551 | get_auto_session_name session_name | |
552 | fi | |
553 | ||
554 | enable_lttng_mmap_overwrite_ust_channel $session_name $channel_name | |
555 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
556 | start_lttng_tracing_ok $session_name | |
557 | ||
558 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
559 | ||
560 | lttng_snapshot_add_output_ok $session_name "net://localhost" "-n $snapshot_name" | |
561 | lttng_snapshot_record $session_name | |
562 | ||
563 | stop_lttng_tracing_ok $session_name | |
564 | destroy_lttng_session_ok $session_name | |
565 | ||
566 | # When session name is automatic, the actual directory is "auto", not | |
567 | # auto-<datetime>. | |
568 | if [ "$is_automatic_session" = true ]; then | |
569 | session_name="auto" | |
570 | fi | |
571 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$snapshot_name* | |
572 | } | |
573 | ||
574 | function test_ust_uid_streaming_snapshot_add_output_custom_name_custom_output () | |
575 | { | |
576 | local session_name="$1" | |
577 | local channel_name=$(randstring 8 0) | |
578 | local snapshot_name="this_is_my_snapshot" | |
579 | local custom_output="this/is/my/custom/path" | |
580 | local is_automatic_session=false | |
581 | ||
582 | if [ -z "$session_name" ]; then | |
583 | is_automatic_session=true | |
584 | fi | |
585 | ||
586 | diag "Test UST uid buffer snapshot using 'add-output' with custom snapshot name and custom output path" | |
587 | ||
588 | create_lttng_session_no_output "$session_name" | |
589 | if [ "$is_automatic_session" = true ]; then | |
590 | get_auto_session_name session_name | |
591 | fi | |
592 | ||
593 | enable_lttng_mmap_overwrite_ust_channel $session_name $channel_name | |
594 | enable_ust_lttng_event_ok $session_name $EVENT_NAME $channel_name | |
595 | start_lttng_tracing_ok $session_name | |
596 | ||
597 | $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT | |
598 | ||
599 | lttng_snapshot_add_output_ok $session_name "net://localhost/$custom_output" "-n $snapshot_name" | |
600 | lttng_snapshot_record $session_name | |
601 | ||
602 | stop_lttng_tracing_ok $session_name | |
603 | destroy_lttng_session_ok $session_name | |
604 | ||
605 | # When session name is automatic, the actual directory is "auto", not | |
606 | # auto-<datetime>. | |
607 | if [ "$is_automatic_session" = true ]; then | |
608 | session_name="auto" | |
609 | fi | |
610 | validate_trace $EVENT_NAME $TRACE_PATH/$session_name/$HOSTNAME*/$custom_output/$snapshot_name* | |
611 | } | |
612 | ||
613 | plan_tests $NUM_TESTS | |
614 | ||
615 | print_test_banner "$TEST_DESC" | |
616 | ||
617 | # Set the relayd in --group-output-by-session mode | |
618 | start_lttng_relayd "-o $TRACE_PATH --group-output-by-session" | |
619 | start_lttng_sessiond | |
620 | ||
621 | tests=( | |
622 | test_ust_uid_live | |
623 | test_ust_pid_live | |
624 | test_ust_uid_live_custom_output | |
625 | test_ust_uid_streaming | |
626 | test_ust_pid_streaming | |
627 | test_ust_uid_streaming_custom_output | |
628 | # Rotation does not exist on stable 2.9 | |
629 | # test_ust_uid_streaming_rotate | |
630 | # test_ust_uid_streaming_rotate_custom_output | |
631 | # test_ust_pid_streaming_rotate | |
632 | test_ust_uid_streaming_snapshot | |
633 | test_ust_pid_streaming_snapshot | |
634 | test_ust_uid_streaming_snapshot_add_output_default_name | |
635 | test_ust_uid_streaming_snapshot_add_output_custom_name | |
636 | test_ust_uid_streaming_snapshot_add_output_custom_name_custom_output | |
637 | ) | |
638 | ||
639 | name="" | |
640 | # Perform test when session name is generated by the client | |
641 | for fct_test in ${tests[@]}; | |
642 | do | |
643 | ${fct_test} "$name" | |
644 | rm -rf $TRACE_PATH/auto/ | |
645 | count=$(ls -1 $TRACE_PATH/ | wc -l) | |
646 | is $count "0" "LTTng-relayd output directory empty" | |
647 | done | |
648 | ||
649 | # Perform test when session name is given | |
650 | for fct_test in ${tests[@]}; | |
651 | do | |
652 | name=$(randstring 16 0) | |
653 | ${fct_test} "$name" | |
654 | rm -rf $TRACE_PATH/$name/ | |
655 | count=$(ls -1 $TRACE_PATH/ | wc -l) | |
656 | is $count "0" "LTTng-relayd output directory empty" | |
657 | done | |
658 | ||
659 | rm -rf $TRACE_PATH | |
660 | ||
661 | stop_lttng_sessiond | |
662 | stop_lttng_relayd |