From: Tom Rini Date: Thu, 21 Sep 2017 20:41:20 -0400 Subject: [U-Boot] [U-Boot, v2, 5/8] test/py: Encode/decode strings for stdio In-Reply-To: <20170914213450.28754-6-paul.burton@imgtec.com> References: <20170914213450.28754-6-paul.burton@imgtec.com> Message-ID: <20170922004120.GA13215@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Sep 14, 2017 at 02:34:47PM -0700, Paul Burton wrote: > When reading stdin python 3.x will give us byte arrays, and when writing > stdout or stderr it will expect byte arrays. In order to insulate the > rest of the code from this difference, call encode or decode at > appropriate points when reading or writing stdio files. This works fine > on python 2.x too. > > Signed-off-by: Paul Burton > Reviewed-by: Stephen Warren OK, this almost works. When I add in the following only the vboot test fails and I can't understand why: diff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py index 21bdcb730917..d23bec0b9668 100644 --- a/test/py/multiplexed_log.py +++ b/test/py/multiplexed_log.py @@ -326,7 +326,7 @@ $(document).ready(function () { data = data.replace(chr(13), '') data = ''.join((c in self._nonprint) and ('%%%02x' % ord(c)) or - c for c in data) + c for c in data.encode('utf-8')) data = cgi.escape(data) return data diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py index 751302a529e8..0490230c83dc 100644 --- a/test/py/u_boot_spawn.py +++ b/test/py/u_boot_spawn.py @@ -136,7 +136,7 @@ class Spawn(object): """ for pi in range(len(patterns)): - if type(patterns[pi]) == type(''): + if type(patterns[pi]) != type(re.compile('')): patterns[pi] = re.compile(patterns[pi]) tstart_s = time.time() Please run 'make tests' on a host with python==python2, thanks! -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: