ZTS: Written props test fails with 4k disks

With 4k disks, this test will fail in the last section because the
expected human readable value of 20.0M is reported as 20.1M. Rather than
use the human readable property, switch to the parsable property and
verify that the values are reasonably close.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: John Kennedy <john.kennedy@delphix.com>
Closes #9477
This commit is contained in:
John Wren Kennedy 2019-10-18 19:27:02 +02:00 committed by Tony Hutter
parent c19a6512fd
commit 601dd2a504

View File

@ -11,7 +11,7 @@
# #
# #
# Copyright (c) 2012, 2016 by Delphix. All rights reserved. # Copyright (c) 2012, 2017 by Delphix. All rights reserved.
# #
# #
@ -216,15 +216,15 @@ for ds in $datasets; do
count=$blocks count=$blocks
sync_pool sync_pool
done done
recursive_output=$(zfs get -r written@current $TESTPOOL | \ recursive_output=$(zfs get -p -r written@current $TESTPOOL | \
grep -v $TESTFS1@ | grep -v $TESTFS2@ | grep -v $TESTFS3@ | \ grep -v $TESTFS1@ | grep -v $TESTFS2@ | grep -v $TESTFS3@ | \
grep -v "VALUE" | grep -v "-") grep -v "VALUE" | grep -v "-")
expected="20.0M" expected="$((20 * mb_block))"
for ds in $datasets; do for ds in $datasets; do
writtenat=$(echo "$recursive_output" | grep -v $ds/) writtenat=$(echo "$recursive_output" | grep -v $ds/)
writtenat=$(echo "$writtenat" | grep $ds | awk '{print $3}') writtenat=$(echo "$writtenat" | grep $ds | awk '{print $3}')
[[ $writtenat == $expected ]] || \ within_percent $writtenat $expected 99.5 || \
log_fail "recursive written property output mismatch" log_fail "Unexpected written@ value on $ds"
done done
log_pass "zfs written and written@ property fields print correct values" log_pass "zfs written and written@ property fields print correct values"