From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D8A59A034F; Thu, 7 May 2020 15:17:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3A5D01DBDF; Thu, 7 May 2020 15:17:05 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 5D85B1DBDA for ; Thu, 7 May 2020 15:17:04 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id r26so6801929wmh.0 for ; Thu, 07 May 2020 06:17:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:content-transfer-encoding:user-agent:mime-version; bh=vwQYCSynMc0jF9TEbltqO7nuK4VRspqNGnpDXNbKOUw=; b=fJL0kaExDFD8peAG3x0z4aXApCYTGz69zeHha1tHa7qV14R3m1xHFa3CgDBecHWC4S eYMgAE84ONSvekvByZ19ZS95awZOQijpQDqOjYyb4dCXP7+9G3IN9h4jKXgquUFfocjg 2pPPt3rCjcg4R1XJnDhBapmA9jnBVgN59lEIiomqCK4SUWdo23gVbAY9eoK9DHaxrYrE ZxK6i1AYE/olDT68l3925zHrhpYOymmg07o5Knbns+be4rsCLL6Zr8IoVcOK+zaorUHW hlrUpW1/15Ika7fjLq5/rgSNXGfqogwzI39Y8HSz1BpTkl0FV+s0CV0sT7y1T8eXYdFt NpQA== X-Gm-Message-State: AGi0PuYveND3N9j+1GmQ2D1rSq8QU1AG28A6/kfqxicoQGWVULi3wWsM bAfhfX9R8kqnMibTwtZOgSS7AdYYwJpUQg== X-Google-Smtp-Source: APiQypJx08gR00f86G9hu4TyU83PttjLIYEEvkWFAHaJEIw7hC8ATeCxI/wJc+Z7Or+6l353ADIu8g== X-Received: by 2002:a05:600c:40d:: with SMTP id q13mr50947wmb.69.1588857423978; Thu, 07 May 2020 06:17:03 -0700 (PDT) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id h17sm8119442wmm.6.2020.05.07.06.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 06:17:03 -0700 (PDT) Message-ID: <3e1491f171e9208a55c303a5dfbcf93d474aa273.camel@debian.org> From: Luca Boccassi To: Christian Ehrhardt , dev Date: Thu, 07 May 2020 14:17:02 +0100 In-Reply-To: <20200507123807.2453227-1-christian.ehrhardt@canonical.com> References: <20200507123807.2453227-1-christian.ehrhardt@canonical.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] autotest: fix pexpect in python3 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, 2020-05-07 at 14:38 +0200, Christian Ehrhardt wrote: > In python3 pexpect wants by default a BytesIO stream as log buffer. > Otherwise it will (silently masked since we just return false) > File "/usr/share/dpdk/test/autotest_runner.py", line 22, in wait_prompt > child.sendline() > File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 555, i= n sendline > return self.send(s + self.linesep) > File "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 543, i= n send > self._log(s, 'send') > File "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 126, i= n _log > self.logfile.write(s) >=20 > We have plenty of other code writing and using this buffer. > So instead of changing the type and modifying many more places we tell th= e > spawn [1] method to encode things right away - then the rest behaves as i= t > did with python2. >=20 > [1]: https://pexpect.readthedocs.io/en/stable/api/pexpect.html#spawn-clas= s >=20 > Signed-off-by: Christian Ehrhardt > --- > app/test/autotest_runner.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/app/test/autotest_runner.py b/app/test/autotest_runner.py > index dfa5f2b2dd..92d4e6e41a 100644 > --- a/app/test/autotest_runner.py > +++ b/app/test/autotest_runner.py > @@ -84,7 +84,7 @@ def pool_init(queue, result_queue): > print("\n%s %s\n" % ("=3D" * 20, prefix), file=3Dstartuplog) > print("\ncmdline=3D%s" % cmdline, file=3Dstartuplog) > =20 > - pool_child =3D pexpect.spawn(cmdline, logfile=3Dstartuplog) > + pool_child =3D pexpect.spawn(cmdline, logfile=3Dstartuplog, enco= ding=3D'utf-8') > =20 > # wait for target to boot > if not wait_prompt(pool_child): Acked-by: Luca Boccassi --=20 Kind regards, Luca Boccassi