X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Fregression%2Ftools%2Frotation%2Frotate_utils.sh;h=2803517f21d0a3d0f08a18c93e70d8037b072562;hb=bf1e8411c30b21bc8dd6184c9890e9885bb7d503;hp=8ff93f91d87085be9c26c1bd10656c02891f9a20;hpb=9d16b343fb9e781fc8d8fa3c448a3f382306dd33;p=lttng-tools.git diff --git a/tests/regression/tools/rotation/rotate_utils.sh b/tests/regression/tools/rotation/rotate_utils.sh index 8ff93f91d..2803517f2 100644 --- a/tests/regression/tools/rotation/rotate_utils.sh +++ b/tests/regression/tools/rotation/rotate_utils.sh @@ -41,8 +41,8 @@ function validate_test_chunks () local_path=$1 today=$2 app_path=$3 - domain=$4 - per_pid=$5 + shift 3 + domains=("$@") local path= local chunk_pattern=$(get_chunk_pattern ${today}) @@ -64,8 +64,14 @@ function validate_test_chunks () # Make sure we don't have anything else in the first 2 chunk directories # besides the kernel folder. for chunk in $(seq 0 1); do - nr_stale=$(ls -A $local_path/${chunk_pattern}-${chunk} | grep -v $domain | wc -l) - ok $nr_stale "No stale folders in chunk ${chunk} directory" + local stale_files + + stale_files=$(ls -A $local_path/${chunk_pattern}-${chunk}) + for domain in "${domains[@]}"; do + stale_files=$(echo "$stale_files" | grep -v $domain) + done + nr_stale=$(echo -n "$stale_files" | wc -l) + ok "$nr_stale" "No stale folders in chunk ${chunk} directory" done # We expect a complete session of 30 events @@ -138,3 +144,20 @@ function rotate_timer_test () 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" +}