From 85395313720eddef7e7ada391aad80fbcde43cd5 Mon Sep 17 00:00:00 2001 From: Sergey Cheremencev Date: Thu, 19 Dec 2024 18:26:24 +0300 Subject: [PATCH] LU-18582 tests: fix conf-sanity/82b random OST idx Sometimes (RANDOM * 2) % 65532 gives the same results in a small selection. This caused smaller number OSTs than requested and resulted in a following failure: wait_update pool_list lustre.test_82b failed Test-Parameters: trivial testlist=conf-sanity env=ONLY=82b Signed-off-by: Sergey Cheremencev Change-Id: Iebaf2fedd52803eb918b4ee9c8111537930a6e38 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57531 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Artem Blagodarenko Reviewed-by: Oleg Drokin --- lustre/tests/conf-sanity.sh | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index a9f11e8..6c2d1a3 100755 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -7296,6 +7296,27 @@ test_81() { # LU-4665 } run_test 81 "sparse OST indexing" +random_ost_indices() { + local num=$1 + local LOV_V1_INSANE_STRIPE_COUNT=65532 + local index + local skip + local i=0 + + while ((i < num)); do + skip=false + + index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT)) + for k in $ost_indices; do + ((index == k)) && skip=true + done + $skip && continue + ost_indices+=" $index" + i=$((i+1)) + done + echo $ost_indices +} + # Here we exercise the stripe placement functionality on a file system that # has formatted the OST with a random index. With the file system the following # functionality is tested: @@ -7321,14 +7342,9 @@ test_82a() { # LU-4665 # Format OSTs with random sparse indices. local i - local index local ost_indices - local LOV_V1_INSANE_STRIPE_COUNT=65532 - for i in $(seq $OSTCOUNT); do - index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT)) - ost_indices+=" $index" - done - ost_indices=$(comma_list $ost_indices) + + ost_indices=$(comma_list $(random_ost_indices 3)) stack_trap "restore_ostindex" EXIT echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices" @@ -7430,14 +7446,9 @@ test_82b() { # LU-4665 # Format OSTs with random sparse indices. local i - local index local ost_indices - local LOV_V1_INSANE_STRIPE_COUNT=65532 - for i in $(seq $OSTCOUNT); do - index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT)) - ost_indices+=" $index" - done - ost_indices=$(comma_list $ost_indices) + + ost_indices=$(comma_list $(random_ost_indices 4)) stack_trap "restore_ostindex" EXIT echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices" -- 1.8.3.1