]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
iotests: Use disk_usage in more places
authorEric Blake <eblake@redhat.com>
Fri, 23 May 2025 16:27:21 +0000 (11:27 -0500)
committerEric Blake <eblake@redhat.com>
Thu, 29 May 2025 21:37:15 +0000 (16:37 -0500)
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 <eblake@redhat.com>
Message-ID: <20250523163041.2548675-6-eblake@redhat.com>
Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
Tested-by: Fiona Ebner <f.ebner@proxmox.com>
tests/qemu-iotests/125
tests/qemu-iotests/308

index 46279d6b382a28e15d34ccbde4b78d0799562436..708e7c5ba2186f398c0cdcffaefa25dffccfa965 100755 (executable)
@@ -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
index ea81dc496a0a26ea9e3cf265fde038a1b0986951..437a9014da504c5c2a75bd77f31093f900324af9 100755 (executable)
@@ -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