[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 5/8] iotests.py: add qemu_tool_popen()
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
[PATCH v2 5/8] iotests.py: add qemu_tool_popen() |
Date: |
Mon, 30 Nov 2020 16:40:21 +0300 |
Split qemu_tool_popen() from qemu_tool_pipe_and_status() to be used
separately.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
tests/qemu-iotests/iotests.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 6c9bcf9042..df9834e43a 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -89,16 +89,21 @@ luks_default_secret_object = 'secret,id=keysec0,data=' + \
luks_default_key_secret_opt = 'key-secret=keysec0'
+def qemu_tool_popen(tool: str, args: Sequence[str],
+ connect_stderr: bool = True) -> subprocess.Popen:
+ stderr = subprocess.STDOUT if connect_stderr else None
+ return subprocess.Popen(args,
+ stdout=subprocess.PIPE,
+ stderr=stderr,
+ universal_newlines=True)
+
+
def qemu_tool_pipe_and_status(tool: str, args: Sequence[str],
connect_stderr: bool = True) -> Tuple[str, int]:
"""
Run a tool and return both its output and its exit code
"""
- stderr = subprocess.STDOUT if connect_stderr else None
- subp = subprocess.Popen(args,
- stdout=subprocess.PIPE,
- stderr=stderr,
- universal_newlines=True)
+ subp = qemu_tool_popen(tool, args, connect_stderr)
output = subp.communicate()[0]
if subp.returncode < 0:
cmd = ' '.join(args)
--
2.21.3
- [PATCH v2 for-6.0 0/8] nbd reconnect on open, Vladimir Sementsov-Ogievskiy, 2020/11/30
- [PATCH v2 4/8] iotests.py: qemu_io(): reuse qemu_tool_pipe_and_status(), Vladimir Sementsov-Ogievskiy, 2020/11/30
- [PATCH v2 5/8] iotests.py: add qemu_tool_popen(),
Vladimir Sementsov-Ogievskiy <=
- [PATCH v2 8/8] iotests: add 306 to test reconnect on nbd open, Vladimir Sementsov-Ogievskiy, 2020/11/30
- [PATCH v2 1/8] block/nbd: move initial connect to coroutine, Vladimir Sementsov-Ogievskiy, 2020/11/30
- [PATCH v2 2/8] nbd: allow reconnect on open, with corresponding new options, Vladimir Sementsov-Ogievskiy, 2020/11/30
- [PATCH v2 6/8] iotests.py: add and use qemu_io_wrap_args(), Vladimir Sementsov-Ogievskiy, 2020/11/30
- [PATCH v2 3/8] iotests.py: fix qemu_tool_pipe_and_status(), Vladimir Sementsov-Ogievskiy, 2020/11/30
- [PATCH v2 7/8] iotests.py: add qemu_io_popen(), Vladimir Sementsov-Ogievskiy, 2020/11/30