qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>,
	Kevin Wolf <kwolf@redhat.com>, Cleber Rosa <crosa@redhat.com>,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
	Max Reitz <mreitz@redhat.com>,
	"open list:Block layer core" <qemu-block@nongnu.org>
Subject: [Qemu-devel] [PULL 1/3] iotests: handle TypeError for Python3 in test 242
Date: Mon, 25 Feb 2019 09:20:13 -0600	[thread overview]
Message-ID: <20190225152015.26089-2-eblake@redhat.com> (raw)
In-Reply-To: <20190225152015.26089-1-eblake@redhat.com>

From: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>

The data type for bytes in Python3 differs from the one in Python2.
Those cases should be managed separately.

Signed-off-by: Andrey Shinkevich <andrey.shinkevich@virtuozzo.com>
Reported-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <1550834773-873512-1-git-send-email-andrey.shinkevich@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
---
 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

  reply	other threads:[~2019-02-25 15:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-25 15:20 [Qemu-devel] [PULL 0/3] NBD patches for 2019-02-25 Eric Blake
2019-02-25 15:20 ` Eric Blake [this message]
2019-02-25 15:20 ` [Qemu-devel] [PULL 2/3] iotests: ensure we print nbd server log on error Eric Blake
2019-02-25 15:20 ` [Qemu-devel] [PULL 3/3] iotests: avoid broken pipe with certtool Eric Blake
2019-02-26 14:03 ` [Qemu-devel] [PULL 0/3] NBD patches for 2019-02-25 Eric Blake

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=20190225152015.26089-2-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=andrey.shinkevich@virtuozzo.com \
    --cc=crosa@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.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).