[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 1/3] iotests: handle TypeError for Python3 in test 24
From: |
Eric Blake |
Subject: |
[Qemu-block] [PULL 1/3] iotests: handle TypeError for Python3 in test 242 |
Date: |
Mon, 25 Feb 2019 09:20:13 -0600 |
From: Andrey Shinkevich <address@hidden>
The data type for bytes in Python3 differs from the one in Python2.
Those cases should be managed separately.
Signed-off-by: Andrey Shinkevich <address@hidden>
Reported-by: Kevin Wolf <address@hidden>
Message-Id: <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: Cleber Rosa <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
---
tests/qemu-iotests/242 | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/qemu-iotests/242 b/tests/qemu-iotests/242
index 16c65edcd7f..446fbf8ea13 100755
--- a/tests/qemu-iotests/242
+++ b/tests/qemu-iotests/242
@@ -20,6 +20,7 @@
import iotests
import json
+import sys
from iotests import qemu_img_create, qemu_io, qemu_img_pipe, \
file_path, img_info_log, log, filter_qemu_io
@@ -65,9 +66,12 @@ def toggle_flag(offset):
with open(disk, "r+b") as f:
f.seek(offset, 0)
c = f.read(1)
- toggled = chr(ord(c) ^ bitmap_flag_unknown)
+ toggled = ord(c) ^ bitmap_flag_unknown
f.seek(-1, 1)
- f.write(toggled)
+ if sys.version_info.major >= 3:
+ f.write(bytes([toggled]))
+ else:
+ f.write(chr(toggled))
qemu_img_create('-f', iotests.imgfmt, disk, '1M')
--
2.20.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-block] [PULL 1/3] iotests: handle TypeError for Python3 in test 242,
Eric Blake <=