|
|
ed5979 |
From 6727e92a97f8ee9f367a41111bef3f5cad4a479a Mon Sep 17 00:00:00 2001
|
|
|
ed5979 |
From: Hanna Reitz <hreitz@redhat.com>
|
|
|
ed5979 |
Date: Mon, 20 Jun 2022 18:27:02 +0200
|
|
|
ed5979 |
Subject: [PATCH 15/20] iotests/106, 214, 308: Read only one size line
|
|
|
ed5979 |
|
|
|
ed5979 |
RH-Author: Hanna Czenczek <hreitz@redhat.com>
|
|
|
ed5979 |
RH-MergeRequest: 145: Show protocol-level information in qemu-img info
|
|
|
ed5979 |
RH-Bugzilla: 1860292
|
|
|
ed5979 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
ed5979 |
RH-Commit: [10/12] 1554e0a92b92ed101a251478ccae43f45f6e071e (hreitz/qemu-kvm-c-9-s)
|
|
|
ed5979 |
|
|
|
ed5979 |
These tests read size information (sometimes disk size, sometimes
|
|
|
ed5979 |
virtual size) from qemu-img info's output. Once qemu-img starts
|
|
|
ed5979 |
printing info about child nodes, we are going to see multiple instances
|
|
|
ed5979 |
of that per image, but these tests are only interested in the first one,
|
|
|
ed5979 |
so use "head -n 1" to get it.
|
|
|
ed5979 |
|
|
|
ed5979 |
Signed-off-by: Hanna Reitz <hreitz@redhat.com>
|
|
|
ed5979 |
Message-Id: <20220620162704.80987-11-hreitz@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ed5979 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
ed5979 |
(cherry picked from commit 74163adda3101b127943f7cbbf8fcccd2d472426)
|
|
|
ed5979 |
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
|
|
|
ed5979 |
---
|
|
|
ed5979 |
tests/qemu-iotests/106 | 4 ++--
|
|
|
ed5979 |
tests/qemu-iotests/214 | 6 ++++--
|
|
|
ed5979 |
tests/qemu-iotests/308 | 4 ++--
|
|
|
ed5979 |
3 files changed, 8 insertions(+), 6 deletions(-)
|
|
|
ed5979 |
|
|
|
ed5979 |
diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106
|
|
|
ed5979 |
index 9d6adb542d..ae0fc46691 100755
|
|
|
ed5979 |
--- a/tests/qemu-iotests/106
|
|
|
ed5979 |
+++ b/tests/qemu-iotests/106
|
|
|
ed5979 |
@@ -66,7 +66,7 @@ for create_mode in off falloc full; do
|
|
|
ed5979 |
expected_size=$((expected_size + $GROWTH_SIZE))
|
|
|
ed5979 |
fi
|
|
|
ed5979 |
|
|
|
ed5979 |
- actual_size=$($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep 'disk size')
|
|
|
ed5979 |
+ actual_size=$($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep 'disk size' | head -n 1)
|
|
|
ed5979 |
actual_size=$(echo "$actual_size" | sed -e 's/^[^0-9]*\([0-9]\+\).*$/\1/')
|
|
|
ed5979 |
|
|
|
ed5979 |
# The actual size may exceed the expected size, depending on the file
|
|
|
ed5979 |
@@ -105,7 +105,7 @@ for growth_mode in falloc full; do
|
|
|
ed5979 |
_make_test_img -o "extent_size_hint=0" 2G
|
|
|
ed5979 |
$QEMU_IMG resize -f "$IMGFMT" --preallocation=$growth_mode "$TEST_IMG" +${GROWTH_SIZE}K
|
|
|
ed5979 |
|
|
|
ed5979 |
- actual_size=$($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep 'disk size')
|
|
|
ed5979 |
+ actual_size=$($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" | grep 'disk size' | head -n 1)
|
|
|
ed5979 |
actual_size=$(echo "$actual_size" | sed -e 's/^[^0-9]*\([0-9]\+\).*$/\1/')
|
|
|
ed5979 |
|
|
|
ed5979 |
if [ $actual_size -lt $GROWTH_SIZE ]; then
|
|
|
ed5979 |
diff --git a/tests/qemu-iotests/214 b/tests/qemu-iotests/214
|
|
|
ed5979 |
index c66e246ba2..55ffcd7f44 100755
|
|
|
ed5979 |
--- a/tests/qemu-iotests/214
|
|
|
ed5979 |
+++ b/tests/qemu-iotests/214
|
|
|
ed5979 |
@@ -102,7 +102,8 @@ let data_size="8 * $cluster_size"
|
|
|
ed5979 |
$QEMU_IO -c "write -P 0xaa 0 $data_size" "$TEST_IMG" \
|
|
|
ed5979 |
2>&1 | _filter_qemu_io | _filter_testdir
|
|
|
ed5979 |
sizeA=$($QEMU_IMG info --output=json "$TEST_IMG" |
|
|
|
ed5979 |
- sed -n '/"actual-size":/ s/[^0-9]//gp')
|
|
|
ed5979 |
+ sed -n '/"actual-size":/ s/[^0-9]//gp' |
|
|
|
ed5979 |
+ head -n 1)
|
|
|
ed5979 |
|
|
|
ed5979 |
_make_test_img 2M -o cluster_size=$cluster_size
|
|
|
ed5979 |
echo "Write compressed data:"
|
|
|
ed5979 |
@@ -124,7 +125,8 @@ $QEMU_IO -c "write -P 0xcc $offset $data_size" "json:{\
|
|
|
ed5979 |
_filter_qemu_io | _filter_testdir
|
|
|
ed5979 |
|
|
|
ed5979 |
sizeB=$($QEMU_IMG info --output=json "$TEST_IMG" |
|
|
|
ed5979 |
- sed -n '/"actual-size":/ s/[^0-9]//gp')
|
|
|
ed5979 |
+ sed -n '/"actual-size":/ s/[^0-9]//gp' |
|
|
|
ed5979 |
+ head -n 1)
|
|
|
ed5979 |
|
|
|
ed5979 |
if [ $sizeA -lt $sizeB ]
|
|
|
ed5979 |
then
|
|
|
ed5979 |
diff --git a/tests/qemu-iotests/308 b/tests/qemu-iotests/308
|
|
|
ed5979 |
index bde4aac2fa..09275e9a10 100755
|
|
|
ed5979 |
--- a/tests/qemu-iotests/308
|
|
|
ed5979 |
+++ b/tests/qemu-iotests/308
|
|
|
ed5979 |
@@ -217,12 +217,12 @@ echo
|
|
|
ed5979 |
echo '=== Remove export ==='
|
|
|
ed5979 |
|
|
|
ed5979 |
# Double-check that $EXT_MP appears as a non-empty file (the raw image)
|
|
|
ed5979 |
-$QEMU_IMG info -f raw "$EXT_MP" | grep 'virtual size'
|
|
|
ed5979 |
+$QEMU_IMG info -f raw "$EXT_MP" | grep 'virtual size' | head -n 1
|
|
|
ed5979 |
|
|
|
ed5979 |
fuse_export_del 'export-mp'
|
|
|
ed5979 |
|
|
|
ed5979 |
# See that the file appears empty again
|
|
|
ed5979 |
-$QEMU_IMG info -f raw "$EXT_MP" | grep 'virtual size'
|
|
|
ed5979 |
+$QEMU_IMG info -f raw "$EXT_MP" | grep 'virtual size' | head -n 1
|
|
|
ed5979 |
|
|
|
ed5979 |
echo
|
|
|
ed5979 |
echo '=== Writable export ==='
|
|
|
ed5979 |
--
|
|
|
ed5979 |
2.31.1
|
|
|
ed5979 |
|