<div dir="ltr">Hello All,<div><br></div><div>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. </div><div><br></div><div>Owen Hilyard</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 15, 2021 at 10:09 AM dliu <<a href="mailto:dliu@iol.unh.edu">dliu@iol.unh.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From: Owen Hilyard <<a href="mailto:ohilyard@iol.unh.edu" target="_blank">ohilyard@iol.unh.edu</a>><br>
<br>
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<br>
strip whitespace from the expected string by default. It is possible to<br>
disable this behavior should it be needed, but we expect that the majority<br>
of use-cases are matching non-whitespace characters.<br>
<br>
Signed-off-by: Owen Hilyard <<a href="mailto:ohilyard@iol.unh.edu" target="_blank">ohilyard@iol.unh.edu</a>><br>
---<br>
framework/crb.py | 9 ++++++++-<br>
1 file changed, 8 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/framework/crb.py b/framework/crb.py<br>
index e7c1cc1c..3964e213 100644<br>
--- a/framework/crb.py<br>
+++ b/framework/crb.py<br>
@@ -79,12 +79,19 @@ class Crb(object):<br>
self.alt_session = None<br>
<br>
def send_expect(self, cmds, expected, timeout=TIMEOUT,<br>
- alt_session=False, verify=False):<br>
+ alt_session=False, verify=False, trim_whitespace=True):<br>
"""<br>
Send commands to crb and return string before expected string. If<br>
there's no expected string found before timeout, TimeoutException will<br>
be raised.<br>
+<br>
+ By default, it will trim the whitespace from the expected string. This<br>
+ behavior can be turned off via the trim_whitespace argument.<br>
"""<br>
+<br>
+ if trim_whitespace:<br>
+ expected = expected.strip()<br>
+<br>
# sometimes there will be no alt_session like VM dut<br>
if alt_session and self.alt_session:<br>
return self.alt_session.session.send_expect(cmds, expected,<br>
-- <br>
2.27.0<br>
<br>
</blockquote></div>