Blame SOURCES/kvm-iotests-Let-216-make-use-of-qemu-io-s-exit-code.patch

1bdc94
From 5914d4c0869766e245b5ed5ea857af72c3b0049e Mon Sep 17 00:00:00 2001
1bdc94
From: Max Reitz <mreitz@redhat.com>
1bdc94
Date: Mon, 18 Jun 2018 16:43:12 +0200
1bdc94
Subject: [PATCH 44/54] iotests: Let 216 make use of qemu-io's exit code
1bdc94
1bdc94
RH-Author: Max Reitz <mreitz@redhat.com>
1bdc94
Message-id: <20180618164312.24423-6-mreitz@redhat.com>
1bdc94
Patchwork-id: 80776
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 5/5] iotests: Let 216 make use of qemu-io's exit code
1bdc94
Bugzilla: 1519617
1bdc94
RH-Acked-by: John Snow <jsnow@redhat.com>
1bdc94
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
1bdc94
As a showcase of how you can use qemu-io's exit code to determine
1bdc94
success or failure (same for qemu-img), this test is changed to use
1bdc94
qemu_io_silent() instead of qemu_io(), and to assert the exit code
1bdc94
instead of logging the filtered result.
1bdc94
1bdc94
One real advantage of this is that in case of an error, you get a
1bdc94
backtrace that helps you locate the issue in the test file quickly.
1bdc94
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Reviewed-by: Eric Blake <eblake@redhat.com>
1bdc94
Message-id: 20180509194302.21585-6-mreitz@redhat.com
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
(cherry picked from commit e4ca4e981a0a389d6af5dc5d8b5fbdd1a05276a0)
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 tests/qemu-iotests/216     | 23 ++++++++++++-----------
1bdc94
 tests/qemu-iotests/216.out | 17 ++---------------
1bdc94
 2 files changed, 14 insertions(+), 26 deletions(-)
1bdc94
1bdc94
diff --git a/tests/qemu-iotests/216 b/tests/qemu-iotests/216
1bdc94
index ca9b47a..3c0ae54 100755
1bdc94
--- a/tests/qemu-iotests/216
1bdc94
+++ b/tests/qemu-iotests/216
1bdc94
@@ -20,7 +20,7 @@
1bdc94
 # Creator/Owner: Max Reitz <mreitz@redhat.com>
1bdc94
 
1bdc94
 import iotests
1bdc94
-from iotests import log, qemu_img_pipe, qemu_io, filter_qemu_io
1bdc94
+from iotests import log, qemu_img, qemu_io_silent
1bdc94
 
1bdc94
 # Need backing file support
1bdc94
 iotests.verify_image_format(supported_fmts=['qcow2', 'qcow', 'qed', 'vmdk'])
1bdc94
@@ -50,14 +50,13 @@ with iotests.FilePath('base.img') as base_img_path, \
1bdc94
     log('--- Setting up images ---')
1bdc94
     log('')
1bdc94
 
1bdc94
-    qemu_img_pipe('create', '-f', iotests.imgfmt, base_img_path, '64M')
1bdc94
+    assert qemu_img('create', '-f', iotests.imgfmt, base_img_path, '64M') == 0
1bdc94
+    assert qemu_io_silent(base_img_path, '-c', 'write -P 1 0M 1M') == 0
1bdc94
+    assert qemu_img('create', '-f', iotests.imgfmt, '-b', base_img_path,
1bdc94
+                    top_img_path) == 0
1bdc94
+    assert qemu_io_silent(top_img_path,  '-c', 'write -P 2 1M 1M') == 0
1bdc94
 
1bdc94
-    log(filter_qemu_io(qemu_io(base_img_path, '-c', 'write -P 1 0M 1M')))
1bdc94
-
1bdc94
-    qemu_img_pipe('create', '-f', iotests.imgfmt, '-b', base_img_path,
1bdc94
-                  top_img_path)
1bdc94
-
1bdc94
-    log(filter_qemu_io(qemu_io(top_img_path,  '-c', 'write -P 2 1M 1M')))
1bdc94
+    log('Done')
1bdc94
 
1bdc94
     log('')
1bdc94
     log('--- Doing COR ---')
1bdc94
@@ -110,6 +109,8 @@ with iotests.FilePath('base.img') as base_img_path, \
1bdc94
     log('--- Checking COR result ---')
1bdc94
     log('')
1bdc94
 
1bdc94
-    log(filter_qemu_io(qemu_io(base_img_path, '-c', 'discard 0 64M')))
1bdc94
-    log(filter_qemu_io(qemu_io(top_img_path,  '-c', 'read -P 1 0M 1M')))
1bdc94
-    log(filter_qemu_io(qemu_io(top_img_path,  '-c', 'read -P 2 1M 1M')))
1bdc94
+    assert qemu_io_silent(base_img_path, '-c', 'discard 0 64M') == 0
1bdc94
+    assert qemu_io_silent(top_img_path,  '-c', 'read -P 1 0M 1M') == 0
1bdc94
+    assert qemu_io_silent(top_img_path,  '-c', 'read -P 2 1M 1M') == 0
1bdc94
+
1bdc94
+    log('Done')
1bdc94
diff --git a/tests/qemu-iotests/216.out b/tests/qemu-iotests/216.out
1bdc94
index d3fc590..45ea857 100644
1bdc94
--- a/tests/qemu-iotests/216.out
1bdc94
+++ b/tests/qemu-iotests/216.out
1bdc94
@@ -3,12 +3,7 @@
1bdc94
 
1bdc94
 --- Setting up images ---
1bdc94
 
1bdc94
-wrote 1048576/1048576 bytes at offset 0
1bdc94
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
1bdc94
-
1bdc94
-wrote 1048576/1048576 bytes at offset 1048576
1bdc94
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
1bdc94
-
1bdc94
+Done
1bdc94
 
1bdc94
 --- Doing COR ---
1bdc94
 
1bdc94
@@ -17,12 +12,4 @@ wrote 1048576/1048576 bytes at offset 1048576
1bdc94
 
1bdc94
 --- Checking COR result ---
1bdc94
 
1bdc94
-discard 67108864/67108864 bytes at offset 0
1bdc94
-64 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
1bdc94
-
1bdc94
-read 1048576/1048576 bytes at offset 0
1bdc94
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
1bdc94
-
1bdc94
-read 1048576/1048576 bytes at offset 1048576
1bdc94
-1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
1bdc94
-
1bdc94
+Done
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94