summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2025-05-23 11:27:21 -0500
committerEric Blake <eblake@redhat.com>2025-05-29 16:37:15 -0500
commitd2b3e32bf7395c710ba44585520d837f6330fa70 (patch)
treedfc54e1ae1c825acabdd7e31b1f4b4dcf14a54bb /tests
parent479ec8106185d0e88d65539df5e940c781a82c53 (diff)
downloadfocaccia-qemu-d2b3e32bf7395c710ba44585520d837f6330fa70.tar.gz
focaccia-qemu-d2b3e32bf7395c710ba44585520d837f6330fa70.zip
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 <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>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/1252
-rwxr-xr-xtests/qemu-iotests/3084
2 files changed, 3 insertions, 3 deletions
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