Tests: add a local size-based rotation test in per-uid buffering mode
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 21 Jun 2022 04:42:34 +0000 (00:42 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 7 Jul 2022 18:49:38 +0000 (14:49 -0400)
This test runs an application up until we observe four archived traces.
Unfortunately, we can't validate their size since they are approximative.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Iecdbf3ee33ed02745a99e7af22c0645b4375413e

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

index 3e926caa90b9706f7bc13e59787f84ca679633f1..ddada1007fb8d6354c670c880dc3eb600d2408fa 100755 (executable)
@@ -17,7 +17,7 @@ EVENT_NAME="tp:tptest"
 
 TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_ust_rotation_trace_path.XXXXXX)
 
-NUM_TESTS=138
+NUM_TESTS=145
 
 source $TESTDIR/utils/utils.sh
 source $CURDIR/rotate_utils.sh
@@ -255,6 +255,33 @@ function test_incompatible_sessions ()
        destroy_lttng_session_ok $SESSION_NAME
 }
 
+function test_ust_local_size_uid ()
+{
+       diag "Rotate uid local session every 2MiB"
+       local size_threshold=$((2 * 1024 * 1024))
+
+       diag "Test ust local with size-based session rotation per-uid"
+       create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+       enable_ust_lttng_channel_ok $SESSION_NAME "channel0" --buffers-uid
+       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
+
+       local archive_count=0
+
+       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
+
+       [[ $archive_count -eq 4 ]]
+       ok $? "Saw four trace archives resulting from trace archive rotations"
+
+       destroy_lttng_session_ok $SESSION_NAME
+}
+
 plan_tests $NUM_TESTS
 
 print_test_banner "$TEST_DESC"
@@ -267,7 +294,7 @@ 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_incompatible_sessions )
+       test_incompatible_sessions test_ust_local_size_uid )
 
 for fct_test in ${tests[@]};
 do
index 2752b0f7a76c84eec8ad2f70db5c9340c7162022..18b673b11452491bc3946abda5aa0225d53be587 100644 (file)
@@ -2265,9 +2265,9 @@ function lttng_enable_rotation_size ()
        ret=$?
        if [[ $expected_to_fail -eq "1" ]]; then
                test "$ret" -ne "0"
-               ok $? "Expected fail on rotate session $sess_name"
+               ok $? "Expected to fail to set a periodic rotation of session $sess_name" "every " $size " bytes"
        else
-               ok $ret "Rotate session $sess_name"
+               ok $ret "Set a scheduled rotation of session $sess_name" "every " $size " bytes"
        fi
 }
 
This page took 0.02668 seconds and 4 git commands to generate.