|
|
7711c0 |
From f32cd24bac5efaf4331b864ad55eed80b0b0d89c Mon Sep 17 00:00:00 2001
|
|
|
7711c0 |
From: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Date: Wed, 20 Mar 2019 16:16:30 +0100
|
|
|
7711c0 |
Subject: [PATCH 032/163] iotests.py: Add is_str()
|
|
|
7711c0 |
|
|
|
7711c0 |
RH-Author: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: <20190320161631.14841-19-jsnow@redhat.com>
|
|
|
7711c0 |
Patchwork-id: 84956
|
|
|
7711c0 |
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH 18/19] iotests.py: Add is_str()
|
|
|
7711c0 |
Bugzilla: 1668956
|
|
|
7711c0 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
7711c0 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
|
|
|
7711c0 |
On Python 2.x, strings are not always unicode strings. This function
|
|
|
7711c0 |
checks whether a given value is a plain string, or a unicode string (if
|
|
|
7711c0 |
there is a difference).
|
|
|
7711c0 |
|
|
|
7711c0 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
Reviewed-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Message-id: 20190210145736.1486-7-mreitz@redhat.com
|
|
|
7711c0 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
7711c0 |
(cherry picked from commit 011a576113000f9c90a8450ef9116cca8d6f2523)
|
|
|
7711c0 |
Signed-off-by: John Snow <jsnow@redhat.com>
|
|
|
7711c0 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
7711c0 |
---
|
|
|
7711c0 |
tests/qemu-iotests/iotests.py | 6 ++++++
|
|
|
7711c0 |
1 file changed, 6 insertions(+)
|
|
|
7711c0 |
|
|
|
7711c0 |
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
|
|
|
7711c0 |
index 4e9b2c4..64bb718 100644
|
|
|
7711c0 |
--- a/tests/qemu-iotests/iotests.py
|
|
|
7711c0 |
+++ b/tests/qemu-iotests/iotests.py
|
|
|
7711c0 |
@@ -216,6 +216,12 @@ def image_size(img):
|
|
|
7711c0 |
r = qemu_img_pipe('info', '--output=json', '-f', imgfmt, img)
|
|
|
7711c0 |
return json.loads(r)['virtual-size']
|
|
|
7711c0 |
|
|
|
7711c0 |
+def is_str(val):
|
|
|
7711c0 |
+ if sys.version_info.major >= 3:
|
|
|
7711c0 |
+ return isinstance(val, str)
|
|
|
7711c0 |
+ else:
|
|
|
7711c0 |
+ return isinstance(val, str) or isinstance(val, unicode)
|
|
|
7711c0 |
+
|
|
|
7711c0 |
test_dir_re = re.compile(r"%s" % test_dir)
|
|
|
7711c0 |
def filter_test_dir(msg):
|
|
|
7711c0 |
return test_dir_re.sub("TEST_DIR", msg)
|
|
|
7711c0 |
--
|
|
|
7711c0 |
1.8.3.1
|
|
|
7711c0 |
|