From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 98D29A0524; Mon, 19 Apr 2021 16:02:41 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60EC54130F; Mon, 19 Apr 2021 16:02:41 +0200 (CEST) Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) by mails.dpdk.org (Postfix) with ESMTP id 6D037412E6 for ; Mon, 19 Apr 2021 16:02:40 +0200 (CEST) Received: by mail-oo1-f42.google.com with SMTP id m25-20020a4abc990000b02901ed4500e31dso778591oop.1 for ; Mon, 19 Apr 2021 07:02:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IRCAUC8Jq4OH2apfBYH0XvPshkgeM+Vru7o8FVm/CMg=; b=LM3Ytjq4hdqU0JkCCeRVVEQz4WNTT9wDyoDkFkGi3NVoY2WLCByDbykPkS7dXD7f9V zkEHKxTursNEyIWy0dA6BH+W1j+hhPtwV4OajSfwQJ5zbONR9gYGVq6JYSEJNN58DIY1 POcfPkCGuBhdRPact2b3FJUvLOYHXXy3Nt7Sk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IRCAUC8Jq4OH2apfBYH0XvPshkgeM+Vru7o8FVm/CMg=; b=N2v37BvO1H34x6sGbsI1ZmLy9k4uZWaL2CRIyja4jFXjDN0zp+Chc5oJYK+a3KYbvV vlhjYhzRvgqvqbGhAmfpYIlWU8kmiysnMFEeK2uZUrYaIfpCVF/YicRUrYVN/1mAOdmA E+02YF3Sh1hQvKUwl6mW7E/1DdK4GMhvUvnlmmjp8pd7wnCj7rdtIBRCwpWe8a32zwz6 JZEUnGLbee9JvQVPUFveR0c4dMLWkiiJDCdFaCjepx5+XgZ6PxRyivRnIDSPbtv7b+iQ imosjS5sy77n8yw8LhcKUsO79uuceA7nJZatFL+0a2YaZ48dDFUMWsGf117f1fg9Fe0E 8Z7g== X-Gm-Message-State: AOAM533BtG2Xoo7pTrA/TiJGg6eyRRlWbr9lxN2pFduyuL9p7JEP16bZ fZ9Fsozsto/W5C5kG9mR6dnX1sEJilzIquoU6KtO9g== X-Google-Smtp-Source: ABdhPJy+/WcKckEGWdMKQR7CpcmghQ3XiATEKO630S37MgT0GvUVALhK4NlIDdbTkRMboZhn7/nLjWKVFlBV537L6Uc= X-Received: by 2002:a4a:d781:: with SMTP id c1mr13616114oou.44.1618840959571; Mon, 19 Apr 2021 07:02:39 -0700 (PDT) MIME-Version: 1.0 References: <20210415140933.23185-1-dliu@iol.unh.edu> In-Reply-To: <20210415140933.23185-1-dliu@iol.unh.edu> From: Owen Hilyard Date: Mon, 19 Apr 2021 10:01:35 -0400 Message-ID: To: dliu Cc: dts@dpdk.org, "Tu, Lijuan" Content-Type: multipart/alternative; boundary="00000000000057f77f05c053c814" Subject: Re: [dts] [PATCH] Strip prompt by default in send_expect X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org Sender: "dts" --00000000000057f77f05c053c814 Content-Type: text/plain; charset="UTF-8" Hello All, David submitted the patch on my behalf as he was the one doing testing for it while I was occupied with school. We considered this patch important enough to sidestep waiting for me to come back to submit it due to the issue's impact on ARM testing. Owen Hilyard On Thu, Apr 15, 2021 at 10:09 AM dliu wrote: > From: Owen Hilyard > > During investigation of timeout exceptions during performance testing, the > community lab found that trailing whitespace in run commands was the cause > of some of the timeouts. This patch makes the Crb version of send_expect > strip whitespace from the expected string by default. It is possible to > disable this behavior should it be needed, but we expect that the majority > of use-cases are matching non-whitespace characters. > > Signed-off-by: Owen Hilyard > --- > framework/crb.py | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/framework/crb.py b/framework/crb.py > index e7c1cc1c..3964e213 100644 > --- a/framework/crb.py > +++ b/framework/crb.py > @@ -79,12 +79,19 @@ class Crb(object): > self.alt_session = None > > def send_expect(self, cmds, expected, timeout=TIMEOUT, > - alt_session=False, verify=False): > + alt_session=False, verify=False, > trim_whitespace=True): > """ > Send commands to crb and return string before expected string. If > there's no expected string found before timeout, TimeoutException > will > be raised. > + > + By default, it will trim the whitespace from the expected string. > This > + behavior can be turned off via the trim_whitespace argument. > """ > + > + if trim_whitespace: > + expected = expected.strip() > + > # sometimes there will be no alt_session like VM dut > if alt_session and self.alt_session: > return self.alt_session.session.send_expect(cmds, expected, > -- > 2.27.0 > > --00000000000057f77f05c053c814 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello All,

David submitted the patch on= my behalf=C2=A0as he was the one doing testing for it while I was occupied= with school. We considered this patch important enough to sidestep waiting= for me to come back to submit it due to the issue's impact on ARM test= ing.=C2=A0

Owen Hilyard

On Thu, Apr 15, 2021= at 10:09 AM dliu <dliu@iol.unh.edu<= /a>> wrote:
F= rom: Owen Hilyard <ohilyard@iol.unh.edu>

During investigation of timeout exceptions during performance testing, the<= br> community lab found that trailing whitespace in run commands was the cause<= br> of some of the timeouts. This patch makes the Crb version of send_expect strip whitespace from the expected string by default. It is possible to
disable this behavior should it be needed, but we expect that the majority<= br> of use-cases are matching non-whitespace characters.

Signed-off-by: Owen Hilyard <ohilyard@iol.unh.edu>
---
=C2=A0framework/crb.py | 9 ++++++++-
=C2=A01 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/framework/crb.py b/framework/crb.py
index e7c1cc1c..3964e213 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -79,12 +79,19 @@ class Crb(object):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.alt_session =3D None
=C2=A0 =C2=A0 =C2=A0def send_expect(self, cmds, expected, timeout=3DTIMEOUT= ,
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 alt_= session=3DFalse, verify=3DFalse):
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 alt_= session=3DFalse, verify=3DFalse, trim_whitespace=3DTrue):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Send commands to crb and return string be= fore expected string. If
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0there's no expected string found befo= re timeout, TimeoutException will
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0be raised.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 By default, it will trim the whitespace from t= he expected string. This
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 behavior can be turned off via the trim_whites= pace argument.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if trim_whitespace:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 expected =3D expected.strip() +
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# sometimes there will be no alt_session = like VM dut
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if alt_session and self.alt_session:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return self.alt_session.ses= sion.send_expect(cmds, expected,
--
2.27.0

--00000000000057f77f05c053c814--