X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Frotation%2Ftest_ust;h=cbeb47d8a4d8326c143ba89a195cd7ad8f3454a2;hb=8d5a3312b34841f1ecba2605acad3eaca79fd5e4;hp=ddada1007fb8d6354c670c880dc3eb600d2408fa;hpb=56f80787af0aa6c608c3927309c4cf3b595e17d2;p=lttng-tools.git diff --git a/tests/regression/tools/rotation/test_ust b/tests/regression/tools/rotation/test_ust index ddada1007..cbeb47d8a 100755 --- a/tests/regression/tools/rotation/test_ust +++ b/tests/regression/tools/rotation/test_ust @@ -15,9 +15,9 @@ TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME" SESSION_NAME="stream" EVENT_NAME="tp:tptest" -TRACE_PATH=$(mktemp --tmpdir -d -t tmp.test_ust_rotation_trace_path.XXXXXX) +TRACE_PATH=$(mktemp -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 @@ -255,6 +255,13 @@ function test_incompatible_sessions () destroy_lttng_session_ok $SESSION_NAME } +function produce_n_events () +{ + local event_count=$1 + + $TESTAPP_BIN -i "$event_count" -w 0 > /dev/null 2>&1 +} + function test_ust_local_size_uid () { diag "Rotate uid local session every 2MiB" @@ -267,17 +274,26 @@ function test_ust_local_size_uid () lttng_enable_rotation_size_ok $SESSION_NAME $size_threshold start_lttng_tracing_ok $SESSION_NAME - local archive_count=0 + # Cutoff at 100 times the expected size + trace_until_n_archives produce_n_events "$TRACE_PATH" 5 $((5 * 100 * size_threshold)) - 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" + # Cutoff at 100 times the expected size + trace_until_n_archives produce_n_events "$TRACE_PATH" 3 $((3 * 100 * size_threshold)) destroy_lttng_session_ok $SESSION_NAME } @@ -294,7 +310,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_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