From: Eric Blake Date: Fri, 23 May 2025 16:27:21 +0000 (-0500) Subject: iotests: Use disk_usage in more places X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d2b3e32bf7395c710ba44585520d837f6330fa70;p=thirdparty%2Fqemu.git iotests: Use disk_usage in more places Commit be9bac07 added a utility disk_usage function, but there are a couple of other tests that could also use it. Signed-off-by: Eric Blake Message-ID: <20250523163041.2548675-6-eblake@redhat.com> Reviewed-by: Fiona Ebner Tested-by: Fiona Ebner --- diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125 index 46279d6b38..708e7c5ba2 100755 --- a/tests/qemu-iotests/125 +++ b/tests/qemu-iotests/125 @@ -35,7 +35,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 get_image_size_on_host() { - echo $(($(stat -c '%b * %B' "$TEST_IMG_FILE"))) + disk_usage "$TEST_IMG_FILE" } # get standard environment and filters diff --git a/tests/qemu-iotests/308 b/tests/qemu-iotests/308 index ea81dc496a..437a9014da 100755 --- a/tests/qemu-iotests/308 +++ b/tests/qemu-iotests/308 @@ -290,7 +290,7 @@ echo '--- Try growing non-growable export ---' # Get the current size so we can write beyond the EOF orig_len=$(get_proto_len "$EXT_MP" "$TEST_IMG") -orig_disk_usage=$(stat -c '%b' "$TEST_IMG") +orig_disk_usage=$(disk_usage "$TEST_IMG") # Should fail (exports are non-growable by default) # (Note that qemu-io can never write beyond the EOF, so we have to use @@ -312,7 +312,7 @@ else echo 'OK: Post-truncate image size is as expected' fi -new_disk_usage=$(stat -c '%b' "$TEST_IMG") +new_disk_usage=$(disk_usage "$TEST_IMG") if [ "$new_disk_usage" -gt "$orig_disk_usage" ]; then echo 'OK: Disk usage grew with fallocate' else