From: Andreas Dilger Date: Wed, 30 Oct 2024 22:10:56 +0000 (-0600) Subject: LU-17527 tests: fix sanity/255a decimal comparison X-Git-Tag: 2.16.0~8 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F36%2F56836%2F2;p=fs%2Flustre-release.git LU-17527 tests: fix sanity/255a decimal comparison Don't use fractional percentages in the sanity test_255a performance comparison, since bash (( ... )) cannot compare numbers with decimal points properly. Instead, just compute the percentage speedup with whole numbers, since the test discards anything less than 20% speedup and a fraction of a percent will not make much difference here. Test-Parameters: trivial Fixes: bdd470ff97 ("LU-9069 tests: improve output of sanity test_255a") Fixes: 395f3e1a55 ("LU-15316 tests: use integers in sanity test_255a") Signed-off-by: Andreas Dilger Change-Id: Id3b37e07168ee2590e52d01f66336027254ced55 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56836 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Arshad Hussain Reviewed-by: Jian Yu Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 7da6397..2139858 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -25357,7 +25357,8 @@ ladvise_no_ioctl() } percent() { - bc <<<"scale=2; ($1 - $2) * 100 / $2" + # don't print any decimal places to avoid bash comparison issues + bc <<< "scale=0; ($1 - $2) * 100 / $2" } # run a random read IO workload @@ -25420,15 +25421,15 @@ ladvise_willread_performance() speedup_ladvise=$(percent $average_ladvise $average_origin) echo "Average uncached read: $average_origin" - echo "Average speedup with OSS cached read:" \ + echo "Average speedup with OSS cached read: " \ "$average_cache = +$speedup_cache%" - echo "Average speedup with ladvise willread:" \ + echo "Average speedup with ladvise willread: " \ "$average_ladvise = +$speedup_ladvise%" local lowest_speedup=20 - if (( ${speedup_cache%.*} < $lowest_speedup )); then + if (( $speedup_cache < $lowest_speedup )); then echo "Speedup with OSS cached read less than $lowest_speedup%,"\ - "got $speedup_cache%. Skipping ladvise willread check." + " got $speedup_cache%. Skipping ladvise willread check." return 0 fi @@ -25439,8 +25440,8 @@ ladvise_willread_performance() echo "osd-zfs does not support dontneed or drop_caches" && return 0 - lowest_speedup=$(bc <<<"scale=2; $speedup_cache / 2") - (( ${speedup_ladvise%.*} > ${lowest_speedup%.*} )) || + lowest_speedup=$(bc <<< "scale=0; $average_cache / 2") + (( $speedup_ladvise > $lowest_speedup )) || error_not_in_vm "Speedup with willread is less than " \ "$lowest_speedup%, got $speedup_ladvise%" }