Replace HMP drive_backup, info block-jobs, and quit with their QMP
equivalents (drive-backup, query-block-jobs, quit). Capture
BLOCK_JOB_COMPLETED and JOB_STATUS_CHANGE events during polling
to keep the output clean.

Signed-off-by: Marc-André Lureau <[email protected]>
---
 tests/qemu-iotests/028     | 27 ++++++++++++++++++++-------
 tests/qemu-iotests/028.out | 17 +++++++++++++----
 2 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
index 28f01439c525..e570c3d303d5 100755
--- a/tests/qemu-iotests/028
+++ b/tests/qemu-iotests/028
@@ -49,7 +49,6 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 _supported_fmt qcow2 qed
 _supported_proto file fuse
 _supported_os Linux
-_require_hmp
 
 # Choose a size that is not necessarily a cluster size multiple for image
 # formats that use clusters.  This will ensure that the base image doesn't end
@@ -109,7 +108,6 @@ echo
 echo block-backup
 echo
 
-qemu_comm_method="monitor"
 _launch_qemu -drive 
file="${TEST_IMG}",cache=${CACHEMODE},aio=${AIOMODE},id=disk
 h=$QEMU_HANDLE
 if [ "${VALGRIND_QEMU}" == "y" ]; then
@@ -119,12 +117,27 @@ else
 fi
 
 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' ""
+_send_qemu_cmd $h "{ 'execute': 'qmp_capabilities' }" 'return'
+
+capture_events="BLOCK_JOB_COMPLETED JOB_STATUS_CHANGE" \
+_send_qemu_cmd $h \
+    "{ 'execute': 'drive-backup',
+       'arguments': { 'device': 'disk',
+                      'target': '${TEST_IMG}.copy',
+                      'sync': 'full',
+                      'mode': 'existing' } }" \
+    "return"
+
+capture_events="BLOCK_JOB_COMPLETED JOB_STATUS_CHANGE" \
+silent=y qemu_cmd_repeat=20 _send_qemu_cmd $h \
+    '{"execute":"query-block-jobs"}' '"return": \[\]'
+
+capture_events="BLOCK_JOB_COMPLETED JOB_STATUS_CHANGE" \
+_send_qemu_cmd $h '{"execute":"query-block-jobs"}' '"return": \[\]'
+
+_send_qemu_cmd $h '{"execute":"quit"}' 'return'
+wait=1 _cleanup_qemu
 
 # Base image sectors
 TEST_IMG="${TEST_IMG}.copy" io readv $(( offset )) 512 1024 32
diff --git a/tests/qemu-iotests/028.out b/tests/qemu-iotests/028.out
index e58048821686..0c63b15360f3 100644
--- a/tests/qemu-iotests/028.out
+++ b/tests/qemu-iotests/028.out
@@ -469,10 +469,19 @@ 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
+{ 'execute': 'qmp_capabilities' }
+{"return": {}}
+{ 'execute': 'drive-backup',
+       'arguments': { 'device': 'disk',
+                      'target': 'TEST_DIR/t.IMGFMT.copy',
+                      'sync': 'full',
+                      'mode': 'existing' } }
+{"return": {}}
+{"execute":"query-block-jobs"}
+{"return": []}
+{"execute":"quit"}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": 
"SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
+{"return": {}}
 === IO: pattern 195
 read 512/512 bytes at offset 3221194240
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)

-- 
2.56.0.rc0.29.g47ce80527c56


Reply via email to