qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy via <qemu-devel@nongnu.org>
To: qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, den@openvz.org, stefanha@redhat.com,
	mreitz@redhat.com, kwolf@redhat.com, jsnow@redhat.com,
	vsementsov@virtuozzo.com, eblake@redhat.com
Subject: [PATCH 4/5] iotests.py: add unarchive_sample_image() helper
Date: Tue, 16 Feb 2021 19:45:26 +0300	[thread overview]
Message-ID: <20210216164527.37745-5-vsementsov@virtuozzo.com> (raw)
In-Reply-To: <20210216164527.37745-1-vsementsov@virtuozzo.com>

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
---
 tests/qemu-iotests/iotests.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 00be68eca3..ea6238f242 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]:
-- 
2.29.2



  parent reply	other threads:[~2021-02-16 17:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 16:45 [PATCH 0/5] parallels: load bitmap extension Vladimir Sementsov-Ogievskiy
2021-02-16 16:45 ` [PATCH 1/5] qcow2-bitmap: make bytes_covered_by_bitmap_cluster() public Vladimir Sementsov-Ogievskiy
2021-02-16 19:19   ` Eric Blake
2021-02-17  7:41   ` Vladimir Sementsov-Ogievskiy
2021-02-18 13:08   ` Denis V. Lunev
2021-02-16 16:45 ` [PATCH 2/5] parallels.txt: fix bitmap L1 table description Vladimir Sementsov-Ogievskiy
2021-02-18 13:47   ` Denis V. Lunev
2021-02-16 16:45 ` [PATCH 3/5] parallels: support bitmap extension for read-only mode Vladimir Sementsov-Ogievskiy
2021-02-19 11:47   ` Denis V. Lunev
2021-02-19 14:11     ` Vladimir Sementsov-Ogievskiy
2021-02-16 16:45 ` Vladimir Sementsov-Ogievskiy via [this message]
2021-02-16 16:45 ` [PATCH 5/5] iotests: add parallels-read-bitmap test Vladimir Sementsov-Ogievskiy
2021-02-19 11:56   ` Denis V. Lunev
2021-02-19 14:16     ` Vladimir Sementsov-Ogievskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210216164527.37745-5-vsementsov@virtuozzo.com \
    --to=qemu-devel@nongnu.org \
    --cc=den@openvz.org \
    --cc=eblake@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).