[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/67] iotests.py: Add image_path()
From: |
Max Reitz |
Subject: |
[PATCH 06/67] iotests.py: Add image_path() |
Date: |
Tue, 1 Oct 2019 21:46:14 +0200 |
Just like we have file_path() as an alternative to FilePath, this is an
alternative fo ImagePath.
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/iotests.py | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 5be6ca674c..280e6c2ec2 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -505,8 +505,12 @@ def file_path_remover():
except OSError:
pass
+def image_path_remover():
+ for path in reversed(image_path_remover.paths):
+ remove_test_image(path)
-def file_path(*names):
+
+def file_path(*names, remover=file_path_remover):
''' Another way to get auto-generated filename that cleans itself up.
Use is as simple as:
@@ -515,19 +519,22 @@ def file_path(*names):
sock = file_path('socket')
'''
- if not hasattr(file_path_remover, 'paths'):
- file_path_remover.paths = []
- atexit.register(file_path_remover)
+ if not hasattr(remover, 'paths'):
+ remover.paths = []
+ atexit.register(remover)
paths = []
for name in names:
filename = file_pattern(name)
path = os.path.join(test_dir, filename)
- file_path_remover.paths.append(path)
+ remover.paths.append(path)
paths.append(path)
return paths[0] if len(paths) == 1 else paths
+def image_path(*names):
+ return file_path(*names, remover=image_path_remover)
+
def remote_filename(path):
if imgproto == 'file':
return path
--
2.21.0
- Re: [PATCH 03/67] iotests.py: Add unsupported_imgopts, (continued)
- [PATCH 05/67] iotests.py: Add ImagePaths, Max Reitz, 2019/10/01
- [PATCH 08/67] iotests.py: Add filter_json_filename(), Max Reitz, 2019/10/01
- [PATCH 09/67] iotests.py: Add @hide_fields to img_info_log, Max Reitz, 2019/10/01
- [PATCH 07/67] iotests.py: Filter data_file in filter_img_info, Max Reitz, 2019/10/01
- [PATCH 06/67] iotests.py: Add image_path(),
Max Reitz <=
- [PATCH 12/67] iotests/228: Filter json:{} filenames, Max Reitz, 2019/10/01
- [PATCH 11/67] iotests/224: Filter json:{} from commit command, Max Reitz, 2019/10/01
- [PATCH 13/67] iotests/242: Hide refcount bit information, Max Reitz, 2019/10/01
- [PATCH 14/67] iotests: Use unsupported_imgopts in Python tests, Max Reitz, 2019/10/01
- [PATCH 15/67] iotests/030: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 10/67] iotests/169: Skip persistent cases for compat=0.10, Max Reitz, 2019/10/01
- [PATCH 18/67] iotests/044: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 16/67] iotests/040: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 19/67] iotests/045: Honor $IMGOPTS, Max Reitz, 2019/10/01
- [PATCH 17/67] iotests/041: Honor $IMGOPTS, Max Reitz, 2019/10/01