zfs_written_property_001_pos using within_percent incorrectly
There are several uses of
within_percent in that test case, and one of them gets the third argument incorrect:
log_note "verify written@ property for recursive datasets" blocks=10 log_must zfs snapshot -r $TESTPOOL/$TESTFS1@now for ds in $datasets; do writtenat=$(get_prop written@now $ds) [[ $writtenat -ne 0 ]] && \ log_fail "Unexpected written@ value" log_must dd if=/dev/urandom of=/$ds/testfile bs=1M count=$blocks log_must sync writtenat=$(get_prop written@now $ds) ((expected_writtenat = blocks * mb_block)) within_percent $writtenat $expected_writtenat 0.1 || \ log_fail "Unexpected written value" ((blocks = blocks + 10)) done
Here we actually do write the data, so we should have writtenat and expected writtenat be nearly the same, i.e. use the same 99.5 as third argument, and not 0.1, which was used when we removed the data and wanted to make sure the writtenat goes to ~0.
This doesn't fail as the check will (almost) always be true, relevant log contents:
NOTE: verify written@ property for recursive datasets SUCCESS: zfs snapshot -r testpool/testfs1@now SUCCESS: dd if=/dev/urandom of=/testpool/testfs1/testfile bs=1M count=10 SUCCESS: sync NOTE: Comparing 10508288 and 10485760 given 0.1% (calculated: 99.78%) SUCCESS: dd if=/dev/urandom of=/testpool/testfs1/testfs2/testfile bs=1M count=20 SUCCESS: sync NOTE: Comparing 21000192 and 20971520 given 0.1% (calculated: 99.86%) SUCCESS: dd if=/dev/urandom of=/testpool/testfs1/testfs2/testfs3/testfile bs=1M count=30 SUCCESS: sync NOTE: Comparing 31493120 and 31457280 given 0.1% (calculated: 99.88%)