From: Nathaniel Clark Date: Wed, 6 Apr 2016 16:09:55 +0000 (-0400) Subject: LU-7993 test: Fix division by 0 in info prints X-Git-Tag: 2.8.55~36 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=6888948c04711a716640d7dad634c10516ec1d1a LU-7993 test: Fix division by 0 in info prints Some of the information only prints in sanity/116a don't account for a 0 in the minimum number and thus divide by zero, but only print if MIN is above zero, so this just doesn't do the calculation if it isn't needed. Signed-off-by: Nathaniel Clark Change-Id: I7003739f6b518f981a1058d41b19bca258e1d11e Reviewed-on: http://review.whamcloud.com/19359 Reviewed-by: Bob Glossman Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index fdfca1f..ef03ac1 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -7617,9 +7617,10 @@ test_116a() { # was previously test_116() echo "Wrote ${DIFF}KB to smaller OST $MINI1" DIFF2=$(($MAXV1 - ${AVAIL[$MAXI1]})) echo "Wrote ${DIFF2}KB to larger OST $MAXI1" - FILL=$(($DIFF2 * 100 / $DIFF - 100)) - [ $DIFF -gt 0 ] && + if [[ $DIFF -gt 0 ]]; then + FILL=$(($DIFF2 * 100 / $DIFF - 100)) echo "Wrote ${FILL}% more data to larger OST $MAXI1" + fi # Figure out which files were written where UUID=$(lctl get_param -n lov.${FSNAME}-clilov-*.target_obd | @@ -7632,9 +7633,10 @@ test_116a() { # was previously test_116() echo $UUID MAXC=$($GETSTRIPE --ost $UUID $DIR/$tdir | grep $DIR | wc -l) echo "$MAXC files created on larger OST $MAXI1" - FILL=$(($MAXC * 100 / $MINC - 100)) - [[ $MINC -gt 0 ]] && + if [[ $MINC -gt 0 ]]; then + FILL=$(($MAXC * 100 / $MINC - 100)) echo "Wrote ${FILL}% more files to larger OST $MAXI1" + fi [[ $MAXC -gt $MINC ]] || error_ignore LU-9 "stripe QOS didn't balance free space" simple_cleanup_common