3 # Copyright (C) 2019 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
5 # SPDX-License-Identifier: LGPL-2.1-only
7 TEST_DESC
="Clear - UST tracing"
10 TESTDIR
=$CURDIR/..
/..
/..
11 EVENT_NAME
="tp:tptest"
13 TESTAPP_PATH
="$TESTDIR/utils/testapp"
14 TESTAPP_NAME
="gen-ust-events"
15 TESTAPP_BIN
="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
19 PAGE_SIZE
=$
(getconf PAGE_SIZE
)
20 TRACE_PATH
=$
(mktemp
-d)
22 source $TESTDIR/utils
/utils.sh
24 if [ ! -x "$TESTAPP_BIN" ]; then
25 BAIL_OUT
"No UST events binary detected."
28 function clean_path
()
36 function cond_start_tracing
()
39 local tracing_active
=$2
41 if [[ $tracing_active -ne 1 ]]; then
42 start_lttng_tracing_ok
$session_name
46 function cond_stop_tracing
()
49 local tracing_active
=$2
51 if [[ $tracing_active -ne 1 ]]; then
52 stop_lttng_tracing_ok
$session_name
56 function do_clear_session
()
59 local tracing_active
=$2
61 local rotate_before
=$4
64 cond_stop_tracing
$session_name $tracing_active
65 if [[ $rotate_before -eq 1 ]]; then
66 rotate_session_ok
$SESSION_NAME
68 lttng_clear_session_ok
$SESSION_NAME
69 if [[ $clear_twice -eq 1 ]]; then
70 lttng_clear_session_ok
$SESSION_NAME
72 if [[ $rotate_after -eq 1 ]]; then
73 if [[ $tracing_active -eq 1 ]]; then
74 rotate_session_ok
$SESSION_NAME
77 rotate_session_fail
$SESSION_NAME
80 cond_start_tracing
$session_name $tracing_active
83 function test_ust_streaming
()
85 local tracing_active
=$1
87 local rotate_before
=$3
90 local local_path
="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
91 local channel_name
="chan"
93 diag
"Test ust streaming clear"
94 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
95 create_lttng_session_uri
$SESSION_NAME net
://localhost
96 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
97 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
98 start_lttng_tracing_ok
$SESSION_NAME
100 do_clear_session
$SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
101 stop_lttng_tracing_ok
$SESSION_NAME
103 if [[ $rotate_before -eq 1 ]]; then
104 validate_trace_count
$EVENT_NAME $local_path 10
106 if [[ "$buffer_type" == "uid" ]]; then
107 validate_trace_empty
$local_path
109 validate_directory_empty
$local_path
113 destroy_lttng_session_ok
$SESSION_NAME
116 function test_ust_streaming_no_event
()
118 local tracing_active
=$1
120 #local rotate_before=$3 ignored
121 #local rotate_after=$4
122 local buffer_type
=uid
123 local local_path
="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
124 local channel_name
="chan"
126 diag
"Test ust streaming clear no event"
127 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
128 create_lttng_session_uri
$SESSION_NAME net
://localhost
129 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
130 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
131 start_lttng_tracing_ok
$SESSION_NAME
133 do_clear_session
$SESSION_NAME "$tracing_active" "$clear_twice" "$rotate_before" "$rotate_after"
134 stop_lttng_tracing_ok
$SESSION_NAME
136 validate_directory_empty
"$local_path"
138 destroy_lttng_session_ok
$SESSION_NAME
141 function test_ust_streaming_rotate_clear
()
143 local tracing_active
=$1
145 local rotate_before
=$3
146 local rotate_after
=$4
148 local local_path
="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
149 local channel_name
="chan"
151 diag
"Test ust streaming rotate-clear"
152 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
153 create_lttng_session_uri
$SESSION_NAME net
://localhost
154 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
155 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
156 start_lttng_tracing_ok
$SESSION_NAME
158 rotate_session_ok
$SESSION_NAME
160 do_clear_session
$SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
162 stop_lttng_tracing_ok
$SESSION_NAME
164 if [[ $rotate_before -eq 1 ]]; then
169 validate_trace_count
$EVENT_NAME $local_path $expect_count
171 destroy_lttng_session_ok
$SESSION_NAME
174 function test_ust_streaming_clear_rotate
()
176 local tracing_active
=$1
178 local rotate_before
=$3
179 local rotate_after
=$4
181 local local_path
="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
182 local channel_name
="chan"
184 diag
"Test ust streaming clear-rotate"
185 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
186 create_lttng_session_uri
$SESSION_NAME net
://localhost
187 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
188 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
189 start_lttng_tracing_ok
$SESSION_NAME
191 do_clear_session
$SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
193 rotate_session_ok
$SESSION_NAME
195 stop_lttng_tracing_ok
$SESSION_NAME
197 if [[ $rotate_before -eq 1 ]]; then
202 validate_trace_count
$EVENT_NAME $local_path $expect_count
204 destroy_lttng_session_ok
$SESSION_NAME
207 function test_ust_streaming_live
()
209 local tracing_active
=$1
213 local local_path
="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
214 local channel_name
="chan"
216 diag
"Test ust streaming live clear"
217 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
218 create_lttng_session_uri
$SESSION_NAME net
://localhost
"--live"
219 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
220 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
221 start_lttng_tracing_ok
$SESSION_NAME
223 do_clear_session
$SESSION_NAME $tracing_active $clear_twice 0 0
224 stop_lttng_tracing_ok
$SESSION_NAME
226 if [[ "$buffer_type" == "uid" ]]; then
227 validate_trace_empty
$local_path
229 validate_directory_empty
$local_path
232 destroy_lttng_session_ok
$SESSION_NAME
236 function test_ust_basic_streaming_live_viewer
()
238 local tracing_active
=$1
242 local local_path
="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
243 local remote_trace_path
="${HOSTNAME}/${SESSION_NAME}"
244 local channel_name
="chan"
245 local bt_output_path
=$
(mktemp
-u)
246 local file_sync_before_exit
=$
(mktemp
-u)
248 diag
"Test ust basic streaming live with viewer"
249 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
250 create_lttng_session_uri
$SESSION_NAME net
://localhost
"--live"
251 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
252 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
253 start_lttng_tracing_ok
$SESSION_NAME
255 wait_live_trace_ready net
://localhost
257 # Connect a live viewer
258 $BABELTRACE_BIN -i lttng-live net
://localhost
/host
/$remote_trace_path > $bt_output_path &
261 wait_live_viewer_connect net
://localhost
263 $TESTAPP_BIN -i 10 --sync-before-exit $file_sync_before_exit &
266 diag
"Wait until viewer sees all 10 expected events"
268 while [ $evcount -ne 10 ]; do
269 evcount
=$
(cat $bt_output_path |
wc -l)
272 pass
"Live viewer read $evcount events, expect 10"
274 destroy_lttng_session_ok
$SESSION_NAME
275 touch $file_sync_before_exit
276 diag
"Wait for application to exit"
278 pass
"Wait for application to exit"
279 diag
"Wait for viewer to exit"
281 ok $?
"Babeltrace succeeds"
282 pass
"Wait for viewer to exit"
284 rm -f $bt_output_path
285 rm -f $file_sync_before_exit
288 function test_ust_streaming_live_viewer
()
290 local tracing_active
=$1
294 local local_path
="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
295 local remote_trace_path
="${HOSTNAME}/${SESSION_NAME}"
296 local channel_name
="chan"
297 local bt_output_path
=$
(mktemp
-d)/bt-output.txt
299 diag
"Test ust streaming live clear with viewer"
300 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
301 create_lttng_session_uri
$SESSION_NAME net
://localhost
"--live"
302 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
303 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
304 start_lttng_tracing_ok
$SESSION_NAME
306 wait_live_trace_ready net
://localhost
308 # Connect a live viewer
309 $BABELTRACE_BIN -i lttng-live net
://localhost
/host
/$remote_trace_path > $bt_output_path &
312 wait_live_viewer_connect net
://localhost
315 do_clear_session
$SESSION_NAME $tracing_active $clear_twice 0 0
316 stop_lttng_tracing_ok
$SESSION_NAME
318 destroy_lttng_session_ok
$SESSION_NAME
319 diag
"Wait for viewer to exit"
321 ok $?
"Babeltrace succeeds"
322 pass
"Wait for viewer to exit"
324 clean_path
$bt_output_path
327 function test_ust_local
()
329 local tracing_active
=$1
331 local rotate_before
=$3
332 local rotate_after
=$4
334 local channel_name
="chan"
336 diag
"Test ust local"
337 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
338 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
339 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
340 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
341 start_lttng_tracing_ok
$SESSION_NAME
343 do_clear_session
$SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
344 stop_lttng_tracing_ok
$SESSION_NAME
346 if [[ $rotate_before -eq 1 ]]; then
347 validate_trace_count
$EVENT_NAME $TRACE_PATH 10
349 if [[ "$buffer_type" == "uid" ]]; then
350 validate_trace_empty
$TRACE_PATH
353 # The sessiond always created a `ust/ directory
354 # whenever the UST domain is active
355 validate_directory_empty
$TRACE_PATH/ust
/
359 destroy_lttng_session_ok
$SESSION_NAME
362 function test_ust_local_no_event
()
364 local tracing_active
=$1
366 #local rotate_before=$3 ignored
367 #local rotate_after=$4 ignored
369 local channel_name
="chan"
371 diag
"Test ust local no event"
372 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
373 create_lttng_session_ok
$SESSION_NAME "$TRACE_PATH"
374 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name "--buffers-$buffer_type"
375 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
376 start_lttng_tracing_ok
$SESSION_NAME
378 do_clear_session
$SESSION_NAME "$tracing_active" "$clear_twice" "$rotate_before" "$rotate_after"
379 stop_lttng_tracing_ok
$SESSION_NAME
381 validate_directory_empty
"$TRACE_PATH"
383 destroy_lttng_session_ok
$SESSION_NAME
386 function test_ust_local_rotate_clear
()
388 local tracing_active
=$1
390 local rotate_before
=$3
391 local rotate_after
=$4
393 local channel_name
="chan"
395 diag
"Test ust local rotate-clear"
396 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
397 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
398 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
399 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
400 start_lttng_tracing_ok
$SESSION_NAME
402 rotate_session_ok
$SESSION_NAME
404 do_clear_session
$SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
406 stop_lttng_tracing_ok
$SESSION_NAME
408 if [[ $rotate_before -eq 1 ]]; then
413 validate_trace_count
$EVENT_NAME $TRACE_PATH $expect_count
415 destroy_lttng_session_ok
$SESSION_NAME
418 function test_ust_local_clear_rotate
()
420 local tracing_active
=$1
422 local rotate_before
=$3
423 local rotate_after
=$4
425 local channel_name
="chan"
427 diag
"Test ust local clear-rotate"
428 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
429 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH
430 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
431 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
432 start_lttng_tracing_ok
$SESSION_NAME
434 do_clear_session
$SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
436 rotate_session_ok
$SESSION_NAME
438 stop_lttng_tracing_ok
$SESSION_NAME
440 if [[ $rotate_before -eq 1 ]]; then
445 validate_trace_count
$EVENT_NAME $TRACE_PATH $expect_count
447 destroy_lttng_session_ok
$SESSION_NAME
450 function do_ust_snapshot
()
452 local session_name
=$1
454 local tracing_active
=$3
457 local channel_name
="snapshot"
459 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
460 enable_ust_lttng_event_ok
$session_name $EVENT_NAME $channel_name
461 start_lttng_tracing_ok
$session_name
463 # Generate 10 events that will sit in the buffers.
466 # Take a first snapshot and validate that the events are present.
467 lttng_snapshot_record
$session_name
468 stop_lttng_tracing_ok
$session_name
469 validate_trace_count
$EVENT_NAME $trace_path 10
471 # Clean the output path
472 clean_path
$trace_path
473 start_lttng_tracing_ok
$session_name
475 do_clear_session
$SESSION_NAME $tracing_active $clear_twice 0 0
477 # Make sure the subsequent snapshot is empty and valid.
478 lttng_snapshot_record
$session_name
479 stop_lttng_tracing_ok
$session_name
480 validate_trace_empty
$trace_path
482 # Clean the output path
483 clean_path
$trace_path
484 start_lttng_tracing_ok
$session_name
486 # Make sure that everything still works, generate events and take a
489 lttng_snapshot_record
$session_name
490 stop_lttng_tracing_ok
$session_name
491 validate_trace_count
$EVENT_NAME $trace_path 10
494 function test_ust_streaming_snapshot
()
496 local tracing_active
=$1
501 diag
"Test ust streaming snapshot clear"
502 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
504 create_lttng_session_uri
$SESSION_NAME net
://localhost
"--snapshot"
505 do_ust_snapshot
$SESSION_NAME $TRACE_PATH $tracing_active $clear_twice $buffer_type
506 destroy_lttng_session_ok
$SESSION_NAME
509 function test_ust_local_snapshot
()
511 local tracing_active
=$1
516 diag
"Test ust local snapshot clear"
517 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
519 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH "--snapshot"
520 do_ust_snapshot
$SESSION_NAME $TRACE_PATH $tracing_active $clear_twice $buffer_type
521 destroy_lttng_session_ok
$SESSION_NAME
524 # snapshot for per-pid is tested independently of the "buffer type" parameter
525 # because an application needs to be live to appear in a snapshot.
526 function test_ust_local_snapshot_per_pid
()
528 local tracing_active
=$1
532 local channel_name
="channel0"
533 local file_sync_before_last
=$
(mktemp
-u)
534 local file_sync_before_last_touch
=$
(mktemp
-u)
535 local file_sync_before_exit
=$
(mktemp
-u)
536 local file_sync_before_exit_touch
=$
(mktemp
-u)
538 diag
"Test ust local snapshot clear per pid"
539 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, buffer_type=$buffer_type"
541 create_lttng_session_ok
$SESSION_NAME $TRACE_PATH "--snapshot"
542 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --buffers-$buffer_type
543 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
544 start_lttng_tracing_ok
$SESSION_NAME
546 # Generate 10 events that will sit in the buffers.
547 $TESTAPP_BIN -i 10 -w 0 \
548 --sync-before-last-event ${file_sync_before_last} \
549 --sync-before-last-event-touch ${file_sync_before_last_touch} \
550 --sync-before-exit ${file_sync_before_exit} \
551 --sync-before-exit-touch ${file_sync_before_exit_touch} >/dev
/null
2>&1 &
553 # Continue only when there is only the last event remaining.
554 while [ ! -f "${file_sync_before_last_touch}" ]; do
558 # Take a first snapshot and validate that the events are present.
559 lttng_snapshot_record
$SESSION_NAME
560 stop_lttng_tracing_ok
$SESSION_NAME
561 validate_trace_count
$EVENT_NAME $TRACE_PATH 9
563 # Clean the output path
564 clean_path
$TRACE_PATH
565 start_lttng_tracing_ok
$SESSION_NAME
567 do_clear_session
$SESSION_NAME $tracing_active $clear_twice 0 0
569 # Make sure the subsequent snapshot is empty and valid.
570 lttng_snapshot_record
$SESSION_NAME
571 stop_lttng_tracing_ok
$SESSION_NAME
572 validate_trace_empty
$TRACE_PATH
574 # Validate that tracing still works and subsequent snapshots are valid.
575 # Clean the output path.
576 clean_path
$TRACE_PATH
577 start_lttng_tracing_ok
$SESSION_NAME
579 # Continue over the last event.
580 touch ${file_sync_before_last}
582 # Wait for the before exit sync point. This ensure that we went over the
584 while [ ! -f "${file_sync_before_exit_touch}" ]; do
588 # Make sure the snapshot contains the last event.
589 lttng_snapshot_record
$SESSION_NAME
590 stop_lttng_tracing_ok
$SESSION_NAME
591 validate_trace_count
$EVENT_NAME $TRACE_PATH 1
593 # Release the application.
594 touch ${file_sync_before_exit}
596 destroy_lttng_session_ok
$SESSION_NAME
598 rm -f ${file_sync_before_last}
599 rm -f ${file_sync_before_last_touch}
600 rm -f ${file_sync_before_exit}
601 rm -f ${file_sync_before_exit_touch}
604 function test_ust_streaming_tracefile_rotation
()
606 local tracing_active
=$1
608 local rotate_before
=$3
609 local rotate_after
=$4
611 local channel_name
="rotchan"
612 local local_path
="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
614 diag
"Test ust streaming clear with tracefile rotation"
615 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
616 create_lttng_session_uri
$SESSION_NAME net
://localhost
617 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --subbuf-size=$PAGE_SIZE \
618 --tracefile-size=$PAGE_SIZE --tracefile-count=2 --buffers-$buffer_type
619 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
620 start_lttng_tracing_ok
$SESSION_NAME
622 do_clear_session
$SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
623 stop_lttng_tracing_ok
$SESSION_NAME
625 if [[ $rotate_before -eq 1 ]]; then
626 validate_trace_count
$EVENT_NAME $local_path 10
628 if [[ "$buffer_type" == "uid" ]]; then
629 validate_trace_empty
$local_path
631 validate_directory_empty
$local_path
635 start_lttng_tracing_ok
$SESSION_NAME
637 stop_lttng_tracing_ok
639 if [[ $rotate_before -eq 1 ]]; then
640 validate_trace_count
$EVENT_NAME $local_path 30
642 validate_trace_count
$EVENT_NAME $local_path 20
645 destroy_lttng_session_ok
$SESSION_NAME
648 # With 1 byte per event (as strict minimum), generating 200000 events
649 # guarantees filling up 2 files of 64k in size, which is the maximum
650 # page size known on Linux
651 function test_ust_streaming_tracefile_rotation_overwrite_files
()
653 local tracing_active
=$1
655 local rotate_before
=$3
656 local rotate_after
=$4
658 local channel_name
="rotchan"
659 local local_path
="${TRACE_PATH}/${HOSTNAME}/${SESSION_NAME}*"
661 diag
"Test ust streaming clear with tracefile rotation, overwrite files"
662 diag
"Parameters: tracing_active=$tracing_active, clear_twice=$clear_twice, rotate_before=$rotate_before, rotate_after=$rotate_after, buffer_type=$buffer_type"
663 create_lttng_session_uri
$SESSION_NAME net
://localhost
664 enable_ust_lttng_channel_ok
$SESSION_NAME $channel_name --subbuf-size=$PAGE_SIZE \
665 --tracefile-size=$PAGE_SIZE --tracefile-count=2 --buffers-$buffer_type
666 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME $channel_name
667 start_lttng_tracing_ok
$SESSION_NAME
668 taskset
-c 0 $TESTAPP_BIN -i 200000
669 do_clear_session
$SESSION_NAME $tracing_active $clear_twice $rotate_before $rotate_after
670 stop_lttng_tracing_ok
$SESSION_NAME
672 if [[ $rotate_before -eq 1 ]]; then
673 validate_trace_count_range_incl_min_excl_max
$EVENT_NAME $local_path 1 200000
675 if [[ "$buffer_type" == "uid" ]]; then
676 validate_trace_empty
$local_path
678 validate_directory_empty
$local_path
682 start_lttng_tracing_ok
$SESSION_NAME
683 taskset
-c 0 $TESTAPP_BIN -i 400000
684 stop_lttng_tracing_ok
686 if [[ $rotate_before -eq 1 ]]; then
687 validate_trace_count_range_incl_min_excl_max
$EVENT_NAME $local_path 1 600000
689 validate_trace_count_range_incl_min_excl_max
$EVENT_NAME $local_path 1 200000
692 destroy_lttng_session_ok
$SESSION_NAME
695 function test_ust_disallow_clear
()
697 diag
"Test ust disallow clear on relay daemon"
698 SESSION_NAME
=$
(randstring
16 0)
700 LTTNG_RELAYD_DISALLOW_CLEAR
=1 start_lttng_relayd
"-o $TRACE_PATH"
704 create_lttng_session_uri
$SESSION_NAME net
://localhost
705 enable_ust_lttng_event_ok
$SESSION_NAME $EVENT_NAME
706 start_lttng_tracing_ok
$SESSION_NAME
707 lttng_clear_session_fail
$SESSION_NAME
708 destroy_lttng_session_ok
$SESSION_NAME
712 clean_path
$TRACE_PATH
715 plan_tests
$NUM_TESTS
717 print_test_banner
"$TEST_DESC"
719 streaming_tests
=(test_ust_streaming
720 test_ust_streaming_rotate_clear
721 test_ust_streaming_clear_rotate
722 test_ust_streaming_tracefile_rotation
723 test_ust_streaming_tracefile_rotation_overwrite_files
724 test_ust_streaming_no_event
727 live_tests
=(test_ust_streaming_live
728 test_ust_basic_streaming_live_viewer
729 test_ust_streaming_live_viewer
732 local_tests
=(test_ust_local
733 test_ust_local_rotate_clear
734 test_ust_local_clear_rotate
735 test_ust_local_no_event
738 snapshot_uid_tests
=(test_ust_streaming_snapshot
739 test_ust_local_snapshot
742 snapshot_pid_tests
=(test_ust_local_snapshot_per_pid
)
744 start_lttng_relayd
"-o $TRACE_PATH"
749 # Clear with tracing active, clear once
750 for fct_test
in ${streaming_tests[@]} ${live_tests[@]} ${local_tests[@]} ${snapshot_uid_tests[@]};
752 SESSION_NAME
=$
(randstring
16 0)
753 ${fct_test} 1 0 0 0 uid
754 clean_path
$TRACE_PATH
757 # Clear with tracing active, clear twice
758 for fct_test
in ${streaming_tests[@]} ${live_tests[@]} ${local_tests[@]} ${snapshot_uid_tests[@]};
760 SESSION_NAME
=$
(randstring
16 0)
761 ${fct_test} 1 1 0 0 uid
762 clean_path
$TRACE_PATH
765 # Clear with tracing inactive, clear once
766 for fct_test
in ${streaming_tests[@]} ${live_tests[@]} ${local_tests[@]} ${snapshot_uid_tests[@]};
768 SESSION_NAME
=$
(randstring
16 0)
769 ${fct_test} 0 0 0 0 uid
770 clean_path
$TRACE_PATH
773 # Clear with tracing inactive, clear twice
774 for fct_test
in ${streaming_tests[@]} ${live_tests[@]} ${local_tests[@]} ${snapshot_uid_tests[@]};
776 SESSION_NAME
=$
(randstring
16 0)
777 ${fct_test} 0 1 0 0 uid
778 clean_path
$TRACE_PATH
781 # Clear with tracing inactive, rotate-clear once
782 for fct_test
in ${streaming_tests[@]} ${local_tests[@]};
784 SESSION_NAME
=$
(randstring
16 0)
785 ${fct_test} 0 0 1 0 uid
786 clean_path
$TRACE_PATH
789 # Clear with tracing inactive, clear once-rotate(fail)
790 for fct_test
in ${streaming_tests[@]} ${local_tests[@]};
792 SESSION_NAME
=$
(randstring
16 0)
793 ${fct_test} 0 0 0 1 uid
794 clean_path
$TRACE_PATH
800 # Clear with tracing active, clear once
801 for fct_test
in ${streaming_tests[@]} ${live_tests[@]} ${local_tests[@]} ${snapshot_pid_tests[@]};
803 SESSION_NAME
=$
(randstring
16 0)
804 ${fct_test} 1 0 0 0 pid
805 clean_path
$TRACE_PATH
808 # Clear with tracing active, clear twice
809 for fct_test
in ${streaming_tests[@]} ${live_tests[@]} ${local_tests[@]} ${snapshot_pid_tests[@]};
811 SESSION_NAME
=$
(randstring
16 0)
812 ${fct_test} 1 1 0 0 pid
813 clean_path
$TRACE_PATH
816 # Clear with tracing inactive, clear once
817 for fct_test
in ${streaming_tests[@]} ${live_tests[@]} ${local_tests[@]} ${snapshot_pid_tests[@]};
819 SESSION_NAME
=$
(randstring
16 0)
820 ${fct_test} 0 0 0 0 pid
821 clean_path
$TRACE_PATH
824 # Clear with tracing inactive, clear twice
825 for fct_test
in ${streaming_tests[@]} ${live_tests[@]} ${local_tests[@]} ${snapshot_pid_tests[@]};
827 SESSION_NAME
=$
(randstring
16 0)
828 ${fct_test} 0 1 0 0 pid
829 clean_path
$TRACE_PATH
832 # Clear with tracing inactive, rotate-clear once
833 for fct_test
in ${streaming_tests[@]} ${local_tests[@]};
835 SESSION_NAME
=$
(randstring
16 0)
836 ${fct_test} 0 0 1 0 pid
837 clean_path
$TRACE_PATH
840 # Clear with tracing inactive, clear once-rotate(fail)
841 for fct_test
in ${streaming_tests[@]} ${local_tests[@]};
843 SESSION_NAME
=$
(randstring
16 0)
844 ${fct_test} 0 0 0 1 pid
845 clean_path
$TRACE_PATH
851 test_ust_disallow_clear