Tests: rotation: add a per-pid size-based rotation test
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 22 Jun 2022 17:52:43 +0000 (13:52 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 7 Jul 2022 18:49:38 +0000 (14:49 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I8f6875567d52dd7d28000ff34fff47f992cdab3f

tests/regression/tools/rotation/rotate_utils.sh
tests/regression/tools/rotation/test_ust

index 0454b7ce3e8d421d97cf2e4c7c3271a1b24c1dd7..2803517f21d0a3d0f08a18c93e70d8037b072562 100644 (file)
@@ -144,3 +144,20 @@ function rotate_timer_test ()
        fi
        shopt -u extglob
 }
        fi
        shopt -u extglob
 }
+
+function wait_for_archives ()
+{
+       local trace_path=$1
+       local target_archive_count=$2
+       local archive_count=0
+
+       diag "Waiting for $target_archive_count size-based rotations to occur"
+       while [[ archive_count -lt $target_archive_count ]]
+       do
+               archive_count=$(find "$TRACE_PATH" -mindepth 2 -maxdepth 2 -type d -path "*archives*" | wc -l)
+               $TESTAPP_BIN -i 2000 -w 0 > /dev/null 2>&1
+       done
+
+       [[ $archive_count -eq $target_archive_count ]]
+       ok $? "Found $target_archive_count trace archives resulting from trace archive rotations"
+}
index ddada1007fb8d6354c670c880dc3eb600d2408fa..7c52f34bced2ac016ba31a43b3213299b5d5ffab 100755 (executable)
@@ -17,7 +17,7 @@ EVENT_NAME="tp:tptest"
 
 TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_ust_rotation_trace_path.XXXXXX)
 
 
 TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_ust_rotation_trace_path.XXXXXX)
 
-NUM_TESTS=145
+NUM_TESTS=152
 
 source $TESTDIR/utils/utils.sh
 source $CURDIR/rotate_utils.sh
 
 source $TESTDIR/utils/utils.sh
 source $CURDIR/rotate_utils.sh
@@ -267,17 +267,24 @@ function test_ust_local_size_uid ()
        lttng_enable_rotation_size_ok $SESSION_NAME $size_threshold
        start_lttng_tracing_ok $SESSION_NAME
 
        lttng_enable_rotation_size_ok $SESSION_NAME $size_threshold
        start_lttng_tracing_ok $SESSION_NAME
 
-       local archive_count=0
+       wait_for_archives "$TRACE_PATH" 5
 
 
-       diag "Waiting for 4 size-based rotations to occur"
-       while [[ archive_count -lt 4 ]]
-       do
-               archive_count=$(find "$TRACE_PATH" -mindepth 2 -maxdepth 2 -type d -path "*archives*" | wc -l)
-               $TESTAPP_BIN -i 2000 -w 0 > /dev/null 2>&1
-       done
+       destroy_lttng_session_ok $SESSION_NAME
+}
+
+function test_ust_local_size_pid ()
+{
+       diag "Rotate uid local session every 2MiB"
+       local size_threshold=$((2 * 1024 * 1024))
+
+       diag "Test ust local with size-based session rotation per-pid"
+       create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+       enable_ust_lttng_channel_ok $SESSION_NAME "channel0" --buffers-pid
+       enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME "channel0"
+       lttng_enable_rotation_size_ok $SESSION_NAME $size_threshold
+       start_lttng_tracing_ok $SESSION_NAME
 
 
-       [[ $archive_count -eq 4 ]]
-       ok $? "Saw four trace archives resulting from trace archive rotations"
+       wait_for_archives "$TRACE_PATH" 3
 
        destroy_lttng_session_ok $SESSION_NAME
 }
 
        destroy_lttng_session_ok $SESSION_NAME
 }
@@ -294,7 +301,8 @@ tests=( test_ust_streaming_uid test_ust_local_uid \
        test_ust_streaming_pid test_ust_local_pid \
        test_ust_local_timer_uid test_ust_streaming_timer_uid \
        test_ust_local_timer_pid test_ust_streaming_timer_pid \
        test_ust_streaming_pid test_ust_local_pid \
        test_ust_local_timer_uid test_ust_streaming_timer_uid \
        test_ust_local_timer_pid test_ust_streaming_timer_pid \
-       test_incompatible_sessions test_ust_local_size_uid )
+       test_ust_local_size_uid test_ust_local_size_pid \
+       test_incompatible_sessions )
 
 for fct_test in ${tests[@]};
 do
 
 for fct_test in ${tests[@]};
 do
This page took 0.02688 seconds and 4 git commands to generate.