diff options
author | Vladimir Sementsov-Ogievskiy | 2021-02-24 11:47:06 +0100 |
---|---|---|
committer | Kevin Wolf | 2021-03-08 14:56:55 +0100 |
commit | 55b116302f26c50772fd8b73f9af13b091461ae5 (patch) | |
tree | bfe53ce1ad9b84ae52b39419f8b79ed20ab39e16 /tests | |
parent | parallels: support bitmap extension for read-only mode (diff) | |
download | qemu-55b116302f26c50772fd8b73f9af13b091461ae5.tar.gz qemu-55b116302f26c50772fd8b73f9af13b091461ae5.tar.xz qemu-55b116302f26c50772fd8b73f9af13b091461ae5.zip |
iotests.py: add unarchive_sample_image() helper
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20210224104707.88430-6-vsementsov@virtuozzo.com>
Reviewed-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/qemu-iotests/iotests.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 4e758308f2..90d0b62523 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -17,6 +17,7 @@ # import atexit +import bz2 from collections import OrderedDict import faulthandler import io @@ -24,6 +25,7 @@ import json import logging import os import re +import shutil import signal import struct import subprocess @@ -96,6 +98,14 @@ luks_default_secret_object = 'secret,id=keysec0,data=' + \ os.environ.get('IMGKEYSECRET', '') luks_default_key_secret_opt = 'key-secret=keysec0' +sample_img_dir = os.environ['SAMPLE_IMG_DIR'] + + +def unarchive_sample_image(sample, fname): + sample_fname = os.path.join(sample_img_dir, sample + '.bz2') + with bz2.open(sample_fname) as f_in, open(fname, 'wb') as f_out: + shutil.copyfileobj(f_in, f_out) + def qemu_tool_pipe_and_status(tool: str, args: Sequence[str], connect_stderr: bool = True) -> Tuple[str, int]: |