Whamcloud - gitweb
LU-13977 tests: fix float comparison in sanity test_255a 01/40001/2
authorMr NeilBrown <neilb@suse.de>
Wed, 23 Sep 2020 01:16:06 +0000 (11:16 +1000)
committerOleg Drokin <green@whamcloud.com>
Fri, 2 Oct 2020 00:19:10 +0000 (00:19 +0000)
  [ $a -gt $b ]
compares integers.

in ladvise_willread_performance(), average_ladvise and lowest_speedup
are calculated to 2 decimals, so they probably aren't integers.  So
this (nearly) always fails, but as the failure is not reported when a
VM is detected, the failure goes unnoticed.

The bash [[ ]] command can be used instead.  Its '>' operator compares
floats.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Ifc674d5804b1269cebce82893a08eace9ffd9be4
Reviewed-on: https://review.whamcloud.com/40001
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
lustre/tests/sanity.sh

index 924d05a..e215505 100755 (executable)
@@ -19360,7 +19360,7 @@ ladvise_willread_performance()
                return 0
 
        lowest_speedup=$(bc <<<"scale=2; $average_cache / 2")
-       [ ${average_ladvise%.*} -gt $lowest_speedup ] ||
+       [[ ${average_ladvise%.*} > $lowest_speedup ]] ||
                error_not_in_vm "Speedup with willread is less than " \
                        "$lowest_speedup%, got $average_ladvise%"
 }