[{"id":1773214,"web_url":"http://patchwork.ozlabs.org/comment/1773214/","msgid":"<20170922004120.GA13215@bill-the-cat>","list_archive_url":null,"date":"2017-09-22T00:41:20","subject":"Re: [U-Boot] [U-Boot, v2,\n\t5/8] test/py: Encode/decode strings for stdio","submitter":{"id":65875,"url":"http://patchwork.ozlabs.org/api/people/65875/","name":"Tom Rini","email":"trini@konsulko.com"},"content":"On Thu, Sep 14, 2017 at 02:34:47PM -0700, Paul Burton wrote:\n\n> When reading stdin python 3.x will give us byte arrays, and when writing\n> stdout or stderr it will expect byte arrays. In order to insulate the\n> rest of the code from this difference, call encode or decode at\n> appropriate points when reading or writing stdio files. This works fine\n> on python 2.x too.\n> \n> Signed-off-by: Paul Burton <paul.burton@imgtec.com>\n> Reviewed-by: Stephen Warren <swarren@nvidia.com>\n\nOK, this almost works.  When I add in the following only the vboot test\nfails and I can't understand why:\n\ndiff --git a/test/py/multiplexed_log.py b/test/py/multiplexed_log.py\nindex 21bdcb730917..d23bec0b9668 100644\n--- a/test/py/multiplexed_log.py\n+++ b/test/py/multiplexed_log.py\n@@ -326,7 +326,7 @@ $(document).ready(function () {\n \n         data = data.replace(chr(13), '')\n         data = ''.join((c in self._nonprint) and ('%%%02x' % ord(c)) or\n-                       c for c in data)\n+                       c for c in data.encode('utf-8'))\n         data = cgi.escape(data)\n         return data\n \ndiff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py\nindex 751302a529e8..0490230c83dc 100644\n--- a/test/py/u_boot_spawn.py\n+++ b/test/py/u_boot_spawn.py\n@@ -136,7 +136,7 @@ class Spawn(object):\n         \"\"\"\n \n         for pi in range(len(patterns)):\n-            if type(patterns[pi]) == type(''):\n+            if type(patterns[pi]) != type(re.compile('')):\n                 patterns[pi] = re.compile(patterns[pi])\n \n         tstart_s = time.time()\n\nPlease run 'make tests' on a host with python==python2, thanks!","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=konsulko.com header.i=@konsulko.com\n\theader.b=\"VdHvlMjB\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyvmv4HsVz9sRg\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 22 Sep 2017 10:41:35 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 2B717C21E1D; Fri, 22 Sep 2017 00:41:30 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 42671C21C29;\n\tFri, 22 Sep 2017 00:41:28 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 90940C21C29; Fri, 22 Sep 2017 00:41:26 +0000 (UTC)","from mail-yw0-f170.google.com (mail-yw0-f170.google.com\n\t[209.85.161.170])\n\tby lists.denx.de (Postfix) with ESMTPS id 79190C21C26\n\tfor <u-boot@lists.denx.de>; Fri, 22 Sep 2017 00:41:23 +0000 (UTC)","by mail-yw0-f170.google.com with SMTP id i6so5205900ywc.9\n\tfor <u-boot@lists.denx.de>; Thu, 21 Sep 2017 17:41:23 -0700 (PDT)","from bill-the-cat ([2606:a000:1401:811b:24e9:4a96:6457:ac31])\n\tby smtp.gmail.com with ESMTPSA id\n\tt66sm1063092ywe.79.2017.09.21.17.41.19\n\t(version=TLS1_2 cipher=AES128-SHA bits=128/128);\n\tThu, 21 Sep 2017 17:41:20 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,\n\tRCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com;\n\ts=google; \n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to:user-agent;\n\tbh=q2t+CmZRiMMz9DLsYWZ6r488HZuo2Vd/iGSs1j53QME=;\n\tb=VdHvlMjB5waiUkdTEf6dBsRC8wqo5MfD7QbdTq4PNPXNFqOp00ct6UuTFmpn1C1lFw\n\tkJxBBCGyrXUf/29I4l1MIv/vm5dNkI/xgwE1Z/airn39G3dhj4jgoN1ybkt+CegXpWR/\n\t/8zBIE9VqSH4m9G/qFJjLmBAyf89XsG66XXCw=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to:user-agent;\n\tbh=q2t+CmZRiMMz9DLsYWZ6r488HZuo2Vd/iGSs1j53QME=;\n\tb=LIebAJjVmjxHwhCN8wqqZf73iktfREilV2gn+C7RCQg+1EcBuZ8ldg+hSS6tDg0Hjs\n\t1ugJ+Kt/7qIKJJXhn0IcWBxKV6nFgDHHyXKbMdn6OFQHxEd4AZeBfvBVq+nGqGW0xLzQ\n\tnw8kTbP3yqIXxedcGa/tFKpmNhOHNjzhhLt/w6I3Q5rEMgu8wFYXrqz8x5241s+ov3SL\n\tr31CwerZnSBrmUAaDZbJNh/jJw2qh8Ok0jwxZFSgQdvsyS+YnEjQXu4Gf2I9FXZbYeqO\n\tQ7gfHV3VezZQMFGtFQzfRdYRLRqXZ7iuKDHd5XqIfJFa1i0j6WAT/oUI3tFSRfDIgOA4\n\t1X0g==","X-Gm-Message-State":"AHPjjUj73uG78Bvyui5g0xKm2DEOQXVqZTCxb9hE23Gy+pI6qXFNJqWy\n\tiIbr9kyBvaaVpUNTG95Ys8ARsA==","X-Google-Smtp-Source":"AOwi7QBV06j0CFH53jE05kWcBl5z43gz/dWD3cxT5kPz8xXqdAWfDoTZBM2JJ90YowmmAfWjesYC6g==","X-Received":"by 10.37.110.68 with SMTP id j65mr2685696ybc.106.1506040882068; \n\tThu, 21 Sep 2017 17:41:22 -0700 (PDT)","Date":"Thu, 21 Sep 2017 20:41:20 -0400","From":"Tom Rini <trini@konsulko.com>","To":"Paul Burton <paul.burton@imgtec.com>","Message-ID":"<20170922004120.GA13215@bill-the-cat>","References":"<20170914213450.28754-6-paul.burton@imgtec.com>","MIME-Version":"1.0","In-Reply-To":"<20170914213450.28754-6-paul.burton@imgtec.com>","User-Agent":"Mutt/1.5.21 (2010-09-15)","Cc":"u-boot@lists.denx.de, Stephen Warren <swarren@nvidia.com>","Subject":"Re: [U-Boot] [U-Boot, v2,\n\t5/8] test/py: Encode/decode strings for stdio","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Type":"multipart/mixed;\n\tboundary=\"===============3278609444441927378==\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]