[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 63/71] iotests.py: Add is_str()
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 63/71] iotests.py: Add is_str() |
Date: |
Mon, 25 Feb 2019 16:20:45 +0100 |
From: Max Reitz <address@hidden>
On Python 2.x, strings are not always unicode strings. This function
checks whether a given value is a plain string, or a unicode string (if
there is a difference).
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: John Snow <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
tests/qemu-iotests/iotests.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 82dd096c6e..52fc77563c 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -236,6 +236,12 @@ def image_size(img):
r = qemu_img_pipe('info', '--output=json', '-f', imgfmt, img)
return json.loads(r)['virtual-size']
+def is_str(val):
+ if sys.version_info.major >= 3:
+ return isinstance(val, str)
+ else:
+ return isinstance(val, str) or isinstance(val, unicode)
+
test_dir_re = re.compile(r"%s" % test_dir)
def filter_test_dir(msg):
return test_dir_re.sub("TEST_DIR", msg)
--
2.20.1
- [Qemu-block] [PULL 50/71] block: Purify .bdrv_refresh_filename(), (continued)
- [Qemu-block] [PULL 50/71] block: Purify .bdrv_refresh_filename(), Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 55/71] block/null: Generate filename even with latency-ns, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 53/71] block/curl: Harmonize option defaults, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 56/71] block: BDS options may lack the "driver" option, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 57/71] iotests: Test json:{} filenames of internal BDSs, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 58/71] iotests: Re-add filename filters, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 59/71] iotests: Fix 237 for Python 2.x, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 60/71] iotests: Remove superfluous rm from 232, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 61/71] iotests: Fix 232 for LUKS, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 62/71] iotests: Fix 207 to use QMP filters for qmp_log, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 63/71] iotests.py: Add is_str(),
Kevin Wolf <=
- [Qemu-block] [PULL 64/71] iotests.py: Filter filename in any string value, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 65/71] iotests: Filter SSH paths, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 66/71] iotests: Let 045 be run concurrently, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 70/71] vmdk: false positive of compat6 with hwversion not set, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 69/71] iotests: add LUKS payload overhead to 178 qemu-img measure test, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 68/71] qcow2: include LUKS payload overhead in qemu-img measure, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 71/71] iotests: Skip 211 on insufficient memory, Kevin Wolf, 2019/02/25
- [Qemu-block] [PULL 67/71] iotests.py: s/_/-/g on keys in qmp_log(), Kevin Wolf, 2019/02/25
- Re: [Qemu-block] [Qemu-devel] [PULL 00/71] Block layer patches, no-reply, 2019/02/27
- Re: [Qemu-block] [PULL 00/71] Block layer patches, Peter Maydell, 2019/02/28