ZTS: Fix zdb_display_block on FreeBSD

Missed this in the review, but wc output on FreeBSD is indented,
so string comparisons mismatch when comparing to an unindented number.

Compare counts as integers instead of strings.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Paul Zuchowski <pzuchowski@datto.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #9980
This commit is contained in:
Ryan Moeller 2020-02-12 16:01:55 -05:00 committed by GitHub
parent e7be5c47bd
commit 9c536b9a78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,7 @@ offset=$(echo "$dva" |awk '{split($0,array,":")} END{print array[2]}')
output=$(export ZDB_NO_ZLE=\"true\";\ output=$(export ZDB_NO_ZLE=\"true\";\
zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null) zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null)
block_cnt=$(echo "$output" | grep 'L0' | wc -l) block_cnt=$(echo "$output" | grep 'L0' | wc -l)
if [ "$block_cnt" != "$write_count" ]; then if [ $block_cnt -ne $write_count ]; then
log_fail "zdb -R :id (indirect block display) failed" log_fail "zdb -R :id (indirect block display) failed"
fi fi
@ -121,7 +121,7 @@ log_note "Reading from DVA $vdev:$offset:$l1_read_size"
output=$(export ZDB_NO_ZLE=\"true\";\ output=$(export ZDB_NO_ZLE=\"true\";\
zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null) zdb -R $TESTPOOL $vdev:$offset:$l1_read_size:id 2> /dev/null)
block_cnt=$(echo "$output" | grep 'L0' | wc -l) block_cnt=$(echo "$output" | grep 'L0' | wc -l)
if [ "$block_cnt" != "$write_count" ]; then if [ $block_cnt -ne $write_count ]; then
log_fail "zdb -R 0.0:offset:length:id (indirect block display) failed" log_fail "zdb -R 0.0:offset:length:id (indirect block display) failed"
fi fi