test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] Strip prompt by default in send_expect
@ 2021-04-15 14:09 dliu
  2021-04-19 14:01 ` Owen Hilyard
  2021-06-09  7:22 ` Tu, Lijuan
  0 siblings, 2 replies; 4+ messages in thread
From: dliu @ 2021-04-15 14:09 UTC (permalink / raw)
  To: dts; +Cc: lijuan.tu, Owen Hilyard

From: Owen Hilyard <ohilyard@iol.unh.edu>

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 <ohilyard@iol.unh.edu>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH] Strip prompt by default in send_expect
  2021-04-15 14:09 [dts] [PATCH] Strip prompt by default in send_expect dliu
@ 2021-04-19 14:01 ` Owen Hilyard
  2021-06-09  7:22 ` Tu, Lijuan
  1 sibling, 0 replies; 4+ messages in thread
From: Owen Hilyard @ 2021-04-19 14:01 UTC (permalink / raw)
  To: dliu; +Cc: dts, Tu, Lijuan

[-- Attachment #1: Type: text/plain, Size: 2046 bytes --]

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 <dliu@iol.unh.edu> wrote:

> From: Owen Hilyard <ohilyard@iol.unh.edu>
>
> 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 <ohilyard@iol.unh.edu>
> ---
>  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
>
>

[-- Attachment #2: Type: text/html, Size: 2755 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dts] [PATCH] Strip prompt by default in send_expect
  2021-04-15 14:09 [dts] [PATCH] Strip prompt by default in send_expect dliu
  2021-04-19 14:01 ` Owen Hilyard
@ 2021-06-09  7:22 ` Tu, Lijuan
  1 sibling, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2021-06-09  7:22 UTC (permalink / raw)
  To: dliu, dts; +Cc: Owen Hilyard


> -----Original Message-----
> From: dliu <dliu@iol.unh.edu>
> Sent: 2021年4月15日 22:10
> To: dts@dpdk.org
> Cc: Tu, Lijuan <lijuan.tu@intel.com>; Owen Hilyard <ohilyard@iol.unh.edu>
> Subject: [PATCH] Strip prompt by default in send_expect
> 
> From: Owen Hilyard <ohilyard@iol.unh.edu>
> 
> 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 <ohilyard@iol.unh.edu>

Applied again.
Some impacted cases are fixed by http://patchwork.dpdk.org/project/dts/patch/20210603092151.1847-1-leweix.yang@intel.com/

> ---
>  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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dts] [PATCH] Strip prompt by default in send_expect
@ 2021-04-15 14:03 dliu
  0 siblings, 0 replies; 4+ messages in thread
From: dliu @ 2021-04-15 14:03 UTC (permalink / raw)
  To: dts; +Cc: Owen Hilyard

From: Owen Hilyard <ohilyard@iol.unh.edu>

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 <ohilyard@iol.unh.edu>
---
 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-09  7:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 14:09 [dts] [PATCH] Strip prompt by default in send_expect dliu
2021-04-19 14:01 ` Owen Hilyard
2021-06-09  7:22 ` Tu, Lijuan
  -- strict thread matches above, loose matches on Subject: below --
2021-04-15 14:03 dliu

test suite reviews and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ https://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git