iotests: Filter out ZFS in several tests

Fiona reported that ZFS makes sparse file testing awkward, since:
- it has asynchronous allocation (not even 'fsync $file' makes du see
  the desired size; it takes the slower 'fsync -f $file' which is not
  appropriate for the tests)
- for tests of fully allocated files, ZFS with compression enabled
  still reports smaller disk usage

Add a new _require_disk_usage that quickly probes whether an attempt
to create a sparse 5M file shows as less than 1M usage, while the same
file with -o preallocation=full shows as more than 4M usage without
sync, which should filter out ZFS behavior.  Then use it in various
affected tests.

This does not add the new filter on all tests that Fiona is seeing ZFS
failures on, but only those where I could quickly spot that there is
at least one place where the test depends on the output of 'du -b' or
'stat -c %b'.

Reported-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-ID: <20250523163041.2548675-8-eblake@redhat.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Eric Blake 2025-05-23 11:27:23 -05:00
parent ed1c336119
commit c49dda7254
8 changed files with 37 additions and 0 deletions

View file

@ -40,6 +40,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_supported_fmt raw
_supported_proto file fuse
_supported_os Linux
_require_disk_usage
# in kB
CREATION_SIZE=128

View file

@ -77,6 +77,7 @@ _supported_os Linux
_default_cache_mode none
_supported_cache_modes none directsync
_require_disk_usage
size=$((1 * 1024 * 1024))

View file

@ -41,6 +41,7 @@ _supported_os Linux
_default_cache_mode writeback
_supported_cache_modes writeback writethrough unsafe
_require_disk_usage
echo
echo "=== Check mapping of unaligned raw image ==="

View file

@ -41,6 +41,7 @@ _supported_os Linux
_default_cache_mode none
_supported_cache_modes none directsync
_require_disk_usage
echo
echo "=== Check mapping of unaligned raw image ==="

View file

@ -51,6 +51,7 @@ _unsupported_fmt vpc
_supported_proto file # We create the FUSE export manually
_supported_os Linux # We need /dev/urandom
_require_disk_usage
# $1: Export ID
# $2: Options (beyond the node-name and ID)

View file

@ -996,6 +996,36 @@ _require_large_file()
rm "$FILENAME"
}
# Check whether disk_usage can be reliably used.
_require_disk_usage()
{
local unusable=false
# ZFS triggers known failures on this front; it does not immediately
# allocate files, and then aggressively compresses writes even when full
# allocation was requested.
if [ -z "$TEST_IMG_FILE" ]; then
FILENAME="$TEST_IMG"
else
FILENAME="$TEST_IMG_FILE"
fi
if [ -e "FILENAME" ]; then
echo "unwilling to overwrite existing file"
exit 1
fi
$QEMU_IMG create -f raw "$FILENAME" 5M > /dev/null
if [ $(disk_usage "$FILENAME") -gt $((1024*1024)) ]; then
unusable=true
fi
$QEMU_IMG create -f raw -o preallocation=full "$FILENAME" 5M > /dev/null
if [ $(disk_usage "$FILENAME") -lt $((4*1024*1024)) ]; then
unusable=true
fi
rm -f "$FILENAME"
if $unusable; then
_notrun "file system on $TEST_DIR does not handle sparse files nicely"
fi
}
# Check that a set of devices is available in the QEMU binary
#
_require_devices()

View file

@ -40,6 +40,7 @@ cd ..
_supported_fmt qcow2 raw # Format of the source. dst is always raw file
_supported_proto file
_supported_os Linux
_require_disk_usage
echo
echo "=== Initial image setup ==="

View file

@ -32,6 +32,7 @@ cd ..
_supported_fmt raw
_supported_proto file
_supported_os Linux
_require_disk_usage
create_test_image() {
_make_test_img -f $IMGFMT 1m