]> Git Repo - qemu.git/commitdiff
iotests: drop qemu_img_verbose() helper
authorVladimir Sementsov-Ogievskiy <[email protected]>
Thu, 23 Dec 2021 16:01:30 +0000 (17:01 +0100)
committerHanna Reitz <[email protected]>
Tue, 1 Feb 2022 09:51:39 +0000 (10:51 +0100)
qemu_img_verbose() has a drawback of not going through generic
qemu_img_pipe_and_status(). qemu_img_verbose() is not very popular, so
update the only two users to qemu_img_log() and drop qemu_img_verbose()
at all.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Hanna Reitz <[email protected]>
Message-Id: <20211223160144.1097696[email protected]>
Signed-off-by: Hanna Reitz <[email protected]>
tests/qemu-iotests/044
tests/qemu-iotests/044.out
tests/qemu-iotests/209
tests/qemu-iotests/209.out
tests/qemu-iotests/iotests.py

index d696e6442ad5b595d16a61f5c0dd6d2603c773c4..a5ee9a7ded3bf1f734322db80689aeeb0ee9a676 100755 (executable)
@@ -24,7 +24,7 @@ import os
 import qcow2
 from qcow2 import QcowHeader
 import iotests
-from iotests import qemu_img, qemu_img_verbose, qemu_io
+from iotests import qemu_img, qemu_img_log, qemu_io
 import struct
 import subprocess
 import sys
@@ -112,10 +112,11 @@ class TestRefcountTableGrowth(iotests.QMPTestCase):
 
     def test_grow_refcount_table(self):
         qemu_io('-c', 'write 3800M 1M', test_img)
-        qemu_img_verbose('check' , test_img)
+        qemu_img_log('check' , test_img)
         pass
 
 if __name__ == '__main__':
+    iotests.activate_logging()
     iotests.main(supported_fmts=['qcow2'],
                  supported_protocols=['file'],
                  unsupported_imgopts=['refcount_bits'])
index 703cf3dee186906c6b7b0104f142f592b9527d79..ff663b17d71f96d1d9ade8b45bdd89a747429419 100644 (file)
@@ -1,6 +1,7 @@
 No errors were found on the image.
 7292415/33554432 = 21.73% allocated, 0.00% fragmented, 0.00% compressed clusters
 Image end offset: 4296217088
+
 .
 ----------------------------------------------------------------------
 Ran 1 tests
index ff7efea11bc69d64ed3ba41c586db435f2370e63..f6ad08ec42a7055634adfcd263d1283849684d29 100755 (executable)
@@ -20,8 +20,8 @@
 #
 
 import iotests
-from iotests import qemu_img_create, qemu_io, qemu_img_verbose, qemu_nbd, \
-                    file_path
+from iotests import qemu_img_create, qemu_io, qemu_img_log, qemu_nbd, \
+                    file_path, log
 
 iotests.script_initialize(supported_fmts=['qcow2'])
 
@@ -33,4 +33,5 @@ qemu_img_create('-f', iotests.imgfmt, disk, '1M')
 qemu_io('-f', iotests.imgfmt, '-c', 'write 0 512K', disk)
 
 qemu_nbd('-k', nbd_sock, '-x', 'exp', '-f', iotests.imgfmt, disk)
-qemu_img_verbose('map', '-f', 'raw', '--output=json', nbd_uri)
+qemu_img_log('map', '-f', 'raw', '--output=json', nbd_uri)
+log('done.')  # avoid new line at the end of output file
index f27be3fa7b0bf619ae5ff0a308fb859abe24a0d6..515906ac7a1962b78ef3787a4a7cd13bd33f1ab8 100644 (file)
@@ -1,2 +1,4 @@
 [{ "start": 0, "length": 524288, "depth": 0, "present": true, "zero": false, "data": true, "offset": 0},
 { "start": 524288, "length": 524288, "depth": 0, "present": true, "zero": true, "data": false, "offset": 524288}]
+
+done.
index 740f8be36ba8561e80e182c0e20698575cbf5e4b..cc4bbbcf7bab81d9e27f297e7a31abf7a5c400bc 100644 (file)
@@ -235,14 +235,6 @@ def qemu_img_measure(*args):
 def qemu_img_check(*args):
     return json.loads(qemu_img_pipe("check", "--output", "json", *args))
 
-def qemu_img_verbose(*args):
-    '''Run qemu-img without suppressing its output and return the exit code'''
-    exitcode = subprocess.call(qemu_img_args + list(args))
-    if exitcode < 0:
-        sys.stderr.write('qemu-img received signal %i: %s\n'
-                         % (-exitcode, ' '.join(qemu_img_args + list(args))))
-    return exitcode
-
 def qemu_img_pipe(*args: str) -> str:
     '''Run qemu-img and return its output'''
     return qemu_img_pipe_and_status(*args)[0]
This page took 0.045089 seconds and 4 git commands to generate.