[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/29] iotests: Drop format-specific in _filter_img_i
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 16/29] iotests: Drop format-specific in _filter_img_info |
Date: |
Tue, 23 Jan 2018 15:01:48 +0100 |
From: Max Reitz <address@hidden>
_filter_img_info should remove format-specific information, too. We
already have such a filter in _img_info, and it is very useful for
query-block-named-block-nodes (etc.), too.
However, in 198 we need that information (but we still want the rest of
the filter), so make that filtering optional. Note that "the rest of
the filter" includes filtering of the test directory, so we can drop the
_filter_testdir from 198 at the same time.
Signed-off-by: Max Reitz <address@hidden>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/198 | 6 ++++--
tests/qemu-iotests/common.filter | 29 ++++++++++++++++++++++++++++-
2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198
index 34ef666381..a84a058396 100755
--- a/tests/qemu-iotests/198
+++ b/tests/qemu-iotests/198
@@ -91,11 +91,13 @@ $QEMU_IO --object $SECRET0 --object $SECRET1 -c "read -P
0x9 0 $size" --image-op
echo
echo "== checking image base =="
-$QEMU_IMG info --image-opts $IMGSPECBASE | _filter_img_info | _filter_testdir
| sed -e "/^disk size:/ D"
+$QEMU_IMG info --image-opts $IMGSPECBASE | _filter_img_info --format-specific \
+ | sed -e "/^disk size:/ D"
echo
echo "== checking image layer =="
-$QEMU_IMG info --image-opts $IMGSPECLAYER | _filter_img_info | _filter_testdir
| sed -e "/^disk size:/ D"
+$QEMU_IMG info --image-opts $IMGSPECLAYER | _filter_img_info --format-specific
\
+ | sed -e "/^disk size:/ D"
# success, all done
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index f08248bfd9..cb2be23340 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -140,6 +140,15 @@ _filter_img_create()
_filter_img_info()
{
+ if [[ "$1" == "--format-specific" ]]; then
+ local format_specific=1
+ shift
+ else
+ local format_specific=0
+ fi
+
+ discard=0
+ regex_json_spec_start='^ *"format-specific": \{'
sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
-e "s#$TEST_DIR#TEST_DIR#g" \
-e "s#$IMGFMT#IMGFMT#g" \
@@ -160,7 +169,25 @@ _filter_img_info()
-e "/block_state_zero: \\(on\\|off\\)/d" \
-e "/log_size: [0-9]\\+/d" \
-e "s/iters: [0-9]\\+/iters: 1024/" \
- -e "s/uuid: [-a-f0-9]\\+/uuid: 00000000-0000-0000-0000-000000000000/"
+ -e "s/uuid: [-a-f0-9]\\+/uuid: 00000000-0000-0000-0000-000000000000/"
| \
+ while IFS='' read -r line; do
+ if [[ $format_specific == 1 ]]; then
+ discard=0
+ elif [[ $line == "Format specific information:" ]]; then
+ discard=1
+ elif [[ $line =~ $regex_json_spec_start ]]; then
+ discard=2
+ regex_json_spec_end="^${line%%[^ ]*}\\},? *$"
+ fi
+ if [[ $discard == 0 ]]; then
+ echo "$line"
+ elif [[ $discard == 1 && ! $line ]]; then
+ echo
+ discard=0
+ elif [[ $discard == 2 && $line =~ $regex_json_spec_end ]]; then
+ discard=0
+ fi
+ done
}
# filter out offsets and file names from qemu-img map; good for both
--
2.13.6
- [Qemu-devel] [PULL 00/29] Block layer patches, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 02/29] hw/block: Fix pin-based interrupt behaviour of NVMe, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 03/29] tests/.gitignore: Add test-bdrv-drain, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 04/29] tests/qemu-iotests: adding savevm/loadvm with postcopy flag test, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 08/29] blockdev: Drop BD-{remove, insert}-medium's @device, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 05/29] qcow2: Repair unaligned preallocated zero clusters, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 01/29] osdep: Retry SETLK upon EINTR, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 06/29] iotests: Make BD-{remove, insert}-medium use @id, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 07/29] tests/ahci: Switch tray and medium commands to @id, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 16/29] iotests: Drop format-specific in _filter_img_info,
Kevin Wolf <=
- [Qemu-devel] [PULL 10/29] qemu-iotests: Fix locking issue in 102, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 13/29] block/qcow: Add blkdebug events, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 11/29] block/vmdk: Fix , instead of ; at end of line, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 14/29] block/vmdk: Add blkdebug events, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 15/29] iotests: Fix _img_info for backslashes, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 09/29] blockdev: Mark BD-{remove, insert}-medium stable, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 20/29] iotests: Fix 051 for compat=0.10, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 12/29] qcow2: No persistent dirty bitmaps for compat=0.10, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 19/29] iotests: Fix 020 for vmdk, Kevin Wolf, 2018/01/23
- [Qemu-devel] [PULL 21/29] iotests: Fix 059's reference output, Kevin Wolf, 2018/01/23