[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/20] iotests: Use convert -n in some cases
From: |
Max Reitz |
Subject: |
[PATCH v2 09/20] iotests: Use convert -n in some cases |
Date: |
Tue, 22 Sep 2020 12:49:21 +0200 |
qemu-img convert (without -n) can often be replaced by a combination of
_make_test_img + qemu-img convert -n. Doing so allows converting to
protocols that do not allow direct file creation, such as FUSE exports.
The only problem is that for formats other than qcow2 and qed (qcow1 at
least), this may lead to high disk usage for some reason, so we cannot
do it everywhere.
But we can do it in 028 and 089, so let us do that so they can run on
FUSE exports. Also, in 028 this allows us to remove a 9-line comment
that used to explain why we cannot safely filter drive-backup's image
creation output.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
tests/qemu-iotests/028 | 14 ++++----------
tests/qemu-iotests/028.out | 3 +++
tests/qemu-iotests/089 | 3 ++-
tests/qemu-iotests/089.out | 1 +
4 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
index 6dd3ae09a3..864dc4a4e2 100755
--- a/tests/qemu-iotests/028
+++ b/tests/qemu-iotests/028
@@ -116,16 +116,10 @@ else
QEMU_COMM_TIMEOUT=1
fi
-# Silence output since it contains the disk image path and QEMU's readline
-# character echoing makes it very hard to filter the output. Plus, there
-# is no telling how many times the command will repeat before succeeding.
-# (Note that creating the image results in a "Formatting..." message over
-# stdout, which is the same channel the monitor uses. We cannot reliably
-# wait for it because the monitor output may interact with it in such a
-# way that _timed_wait_for cannot read it. However, once the block job is
-# done, we know that the "Formatting..." message must have appeared
-# already, so the output is still deterministic.)
-silent=y _send_qemu_cmd $h "drive_backup disk ${TEST_IMG}.copy" "(qemu)"
+TEST_IMG="$TEST_IMG.copy" _make_test_img $image_size
+_send_qemu_cmd $h "drive_backup -n disk ${TEST_IMG}.copy" "(qemu)" \
+ | _filter_imgfmt
+
silent=y qemu_cmd_repeat=20 _send_qemu_cmd $h "info block-jobs" "No active
jobs"
_send_qemu_cmd $h "info block-jobs" "No active jobs"
_send_qemu_cmd $h 'quit' ""
diff --git a/tests/qemu-iotests/028.out b/tests/qemu-iotests/028.out
index 5a68de5c46..e580488216 100644
--- a/tests/qemu-iotests/028.out
+++ b/tests/qemu-iotests/028.out
@@ -468,6 +468,9 @@ No errors were found on the image.
block-backup
+Formatting 'TEST_DIR/t.IMGFMT.copy', fmt=IMGFMT size=4294968832
+QEMU X.Y.Z monitor - type 'help' for more information
+(qemu) drive_backup -n disk TEST_DIR/t.IMGFMT.copy
(qemu) info block-jobs
No active jobs
=== IO: pattern 195
diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089
index 66c5415abe..03a2ccf1e8 100755
--- a/tests/qemu-iotests/089
+++ b/tests/qemu-iotests/089
@@ -62,7 +62,8 @@ TEST_IMG="$TEST_IMG.base" _make_test_img $IMG_SIZE
$QEMU_IO -c 'write -P 42 0 512' -c 'write -P 23 512 512' \
-c 'write -P 66 1024 512' "$TEST_IMG.base" | _filter_qemu_io
-$QEMU_IMG convert -f raw -O $IMGFMT "$TEST_IMG.base" "$TEST_IMG"
+_make_test_img $IMG_SIZE
+$QEMU_IMG convert -f raw -O $IMGFMT -n "$TEST_IMG.base" "$TEST_IMG"
$QEMU_IO_PROG --cache $CACHEMODE --aio $AIOMODE \
-c 'read -P 42 0 512' -c 'read -P 23 512 512' \
diff --git a/tests/qemu-iotests/089.out b/tests/qemu-iotests/089.out
index 15682c2886..c53fc4823a 100644
--- a/tests/qemu-iotests/089.out
+++ b/tests/qemu-iotests/089.out
@@ -9,6 +9,7 @@ wrote 512/512 bytes at offset 512
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 512/512 bytes at offset 1024
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
read 512/512 bytes at offset 0
512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 512/512 bytes at offset 512
--
2.26.2
- [PATCH v2 00/20] block/export: Allow exporting BDSs via FUSE, Max Reitz, 2020/09/22
- [PATCH v2 01/20] configure: Detect libfuse, Max Reitz, 2020/09/22
- [PATCH v2 03/20] fuse: Implement standard FUSE operations, Max Reitz, 2020/09/22
- [PATCH v2 04/20] fuse: Allow growable exports, Max Reitz, 2020/09/22
- [PATCH v2 02/20] fuse: Allow exporting BDSs via FUSE, Max Reitz, 2020/09/22
- [PATCH v2 05/20] fuse: (Partially) implement fallocate(), Max Reitz, 2020/09/22
- [PATCH v2 06/20] fuse: Implement hole detection through lseek, Max Reitz, 2020/09/22
- [PATCH v2 07/20] iotests: Do not needlessly filter _make_test_img, Max Reitz, 2020/09/22
- [PATCH v2 08/20] iotests: Do not pipe _make_test_img, Max Reitz, 2020/09/22
- [PATCH v2 09/20] iotests: Use convert -n in some cases,
Max Reitz <=
- [PATCH v2 10/20] iotests/046: Avoid renaming images, Max Reitz, 2020/09/22
- [PATCH v2 11/20] iotests: Derive image names from $TEST_IMG, Max Reitz, 2020/09/22
- [PATCH v2 12/20] iotests/091: Use _cleanup_qemu instad of "wait", Max Reitz, 2020/09/22
- [PATCH v2 13/20] iotests: Restrict some Python tests to file, Max Reitz, 2020/09/22
- [PATCH v2 15/20] iotests/287: Clean up subshell test image, Max Reitz, 2020/09/22
- [PATCH v2 16/20] storage-daemon: Call bdrv_close_all() on exit, Max Reitz, 2020/09/22
- [PATCH v2 14/20] iotests: Let _make_test_img guess $TEST_IMG_FILE, Max Reitz, 2020/09/22
- [PATCH v2 17/20] iotests: Give access to the qemu-storage-daemon, Max Reitz, 2020/09/22
- [PATCH v2 18/20] iotests: Allow testing FUSE exports, Max Reitz, 2020/09/22
- [PATCH v2 19/20] iotests: Enable fuse for many tests, Max Reitz, 2020/09/22