From: Max Reitz <mreitz@redhat.com>
To: qemu-block@nongnu.org
Cc: Thomas Huth <thuth@redhat.com>,
qemu-devel@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [PATCH v2 03/23] iotests.py: Add @base_dir to FilePaths etc.
Date: Thu, 17 Oct 2019 15:31:35 +0200 [thread overview]
Message-ID: <20191017133155.5327-4-mreitz@redhat.com> (raw)
In-Reply-To: <20191017133155.5327-1-mreitz@redhat.com>
Specifying this optional parameter allows creating temporary files in
other directories than the test_dir; for example in sock_dir.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
tests/qemu-iotests/iotests.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 0616129342..b61ff30961 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -375,10 +375,10 @@ class FilePaths(object):
qemu_img('create', img_path, '1G')
# migration_sock_path is automatically deleted
"""
- def __init__(self, names):
+ def __init__(self, names, base_dir=test_dir):
self.paths = []
for name in names:
- self.paths.append(os.path.join(test_dir, file_pattern(name)))
+ self.paths.append(os.path.join(base_dir, file_pattern(name)))
def __enter__(self):
return self.paths
@@ -395,8 +395,8 @@ class FilePath(FilePaths):
"""
FilePath is a specialization of FilePaths that takes a single filename.
"""
- def __init__(self, name):
- super(FilePath, self).__init__([name])
+ def __init__(self, name, base_dir=test_dir):
+ super(FilePath, self).__init__([name], base_dir)
def __enter__(self):
return self.paths[0]
@@ -409,7 +409,7 @@ def file_path_remover():
pass
-def file_path(*names):
+def file_path(*names, base_dir=test_dir):
''' Another way to get auto-generated filename that cleans itself up.
Use is as simple as:
@@ -425,7 +425,7 @@ def file_path(*names):
paths = []
for name in names:
filename = file_pattern(name)
- path = os.path.join(test_dir, filename)
+ path = os.path.join(base_dir, filename)
file_path_remover.paths.append(path)
paths.append(path)
--
2.21.0
next prev parent reply other threads:[~2019-10-17 14:15 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-17 13:31 [PATCH v2 00/23] iotests: Add and use $SOCK_DIR Max Reitz
2019-10-17 13:31 ` [PATCH v2 01/23] iotests: Introduce $SOCK_DIR Max Reitz
2019-10-17 14:52 ` Eric Blake
2019-10-18 9:03 ` Max Reitz
2019-10-18 13:30 ` Eric Blake
2019-10-17 13:31 ` [PATCH v2 02/23] iotests.py: Store socket files in $SOCK_DIR Max Reitz
2019-10-17 13:31 ` Max Reitz [this message]
2019-10-17 13:31 ` [PATCH v2 04/23] iotests: Filter $SOCK_DIR Max Reitz
2019-10-17 15:50 ` Thomas Huth
2019-10-17 13:31 ` [PATCH v2 05/23] iotests: Let common.nbd create socket in $SOCK_DIR Max Reitz
2019-10-17 15:52 ` Thomas Huth
2019-10-17 13:31 ` [PATCH v2 06/23] iotests/083: Create " Max Reitz
2019-10-17 13:31 ` [PATCH v2 07/23] iotests/140: " Max Reitz
2019-10-17 13:31 ` [PATCH v2 08/23] iotests/143: " Max Reitz
2019-10-17 13:31 ` [PATCH v2 09/23] iotests/147: " Max Reitz
2019-10-17 13:31 ` [PATCH v2 10/23] iotests/181: " Max Reitz
2019-10-17 13:31 ` [PATCH v2 11/23] iotests/182: " Max Reitz
2019-10-17 13:31 ` [PATCH v2 12/23] iotests/183: " Max Reitz
2019-10-17 13:31 ` [PATCH v2 13/23] iotests/192: " Max Reitz
2019-10-17 15:53 ` Thomas Huth
2019-10-17 13:31 ` [PATCH v2 14/23] iotests/194: Create sockets " Max Reitz
2019-10-17 13:31 ` [PATCH v2 15/23] iotests/201: Create socket " Max Reitz
2019-10-17 15:55 ` Thomas Huth
2019-10-17 13:31 ` [PATCH v2 16/23] iotests/205: " Max Reitz
2019-10-17 15:56 ` Thomas Huth
2019-10-17 13:31 ` [PATCH v2 17/23] iotests/208: " Max Reitz
2019-10-17 13:31 ` [PATCH v2 18/23] iotests/209: " Max Reitz
2019-10-17 13:31 ` [PATCH v2 19/23] iotests/222: " Max Reitz
2019-10-17 13:31 ` [PATCH v2 20/23] iotests/223: " Max Reitz
2019-10-17 15:57 ` Thomas Huth
2019-10-17 13:31 ` [PATCH v2 21/23] iotests/240: " Max Reitz
2019-10-17 15:57 ` Thomas Huth
2019-10-17 13:31 ` [PATCH v2 22/23] iotests/267: " Max Reitz
2019-10-17 15:58 ` Thomas Huth
2019-10-17 13:31 ` [PATCH v2 23/23] iotests: Drop TEST_DIR filter from _filter_nbd Max Reitz
2019-10-17 15:58 ` Thomas Huth
2019-10-17 14:59 ` [PATCH v2 00/23] iotests: Add and use $SOCK_DIR Eric Blake
2019-10-18 16:02 ` Max Reitz
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=20191017133155.5327-4-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.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).