test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts]  [PATCH] framework: handling _prompt and ssh exceptions
@ 2020-05-14 21:18 Thinh Tran
  2020-05-19  2:00 ` Tu, Lijuan
  0 siblings, 1 reply; 2+ messages in thread
From: Thinh Tran @ 2020-05-14 21:18 UTC (permalink / raw)
  To: dts; +Cc: Thinh Tran

We may got two exceptions that are raised one right after the other.
It seems to be only in python3 failing to handling it.

In this case are TIMEOUTs of the execution of a command and of the ssh
session:
......
    raise TimeoutException(command, self.get_output_all())
exception.TimeoutException: TIMEOUT on lsof -Fp
/var/run/dpdk/dpdk_73008_20200514164308/config
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line
111, in expect_loop
    incoming = spawn.read_nonblocking(spawn.maxread, timeout)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/pty_spawn.py",
line 509, in read_nonblocking
    raise TIMEOUT('Timeout exceeded.')
pexpect.exceptions.TIMEOUT: Timeout exceeded.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line
119, in expect_loop
    return self.timeout(e)
  File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line
82, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pxssh.pxssh object at 0x70b17a7c1be0>
command: /usr/bin/ssh
args: [b'/usr/bin/ssh', b'-q', b'-l', b'root', b'9.114.224.16']
buffer (last 100 chars): ''
.......

Signed-off-by: Thinh Tran <thinhtr@linux.vnet.ibm.com>
---
 framework/ssh_pexpect.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py
index df610c1..0230207 100644
--- a/framework/ssh_pexpect.py
+++ b/framework/ssh_pexpect.py
@@ -133,7 +133,7 @@ class SSHPexpect:
 
     def __prompt(self, command, timeout):
         if not self.session.prompt(timeout):
-            raise TimeoutException(command, self.get_output_all())
+            raise TimeoutException(command, self.get_output_all()) from None
 
     def __sendline(self, command):
         if not self.isalive():
-- 
2.17.0


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

* Re: [dts] [PATCH] framework: handling _prompt and ssh exceptions
  2020-05-14 21:18 [dts] [PATCH] framework: handling _prompt and ssh exceptions Thinh Tran
@ 2020-05-19  2:00 ` Tu, Lijuan
  0 siblings, 0 replies; 2+ messages in thread
From: Tu, Lijuan @ 2020-05-19  2:00 UTC (permalink / raw)
  To: Thinh Tran, dts

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Thinh Tran
> Sent: Friday, May 15, 2020 5:19 AM
> To: dts@dpdk.org
> Cc: Thinh Tran <thinhtr@linux.vnet.ibm.com>
> Subject: [dts] [PATCH] framework: handling _prompt and ssh exceptions
> 
> We may got two exceptions that are raised one right after the other.
> It seems to be only in python3 failing to handling it.
> 
> In this case are TIMEOUTs of the execution of a command and of the ssh
> session:
> ......
>     raise TimeoutException(command, self.get_output_all())
> exception.TimeoutException: TIMEOUT on lsof -Fp
> /var/run/dpdk/dpdk_73008_20200514164308/config
> Error in atexit._run_exitfuncs:
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 111,
> in expect_loop
>     incoming = spawn.read_nonblocking(spawn.maxread, timeout)
>   File "/usr/local/lib/python3.6/dist-packages/pexpect/pty_spawn.py",
> line 509, in read_nonblocking
>     raise TIMEOUT('Timeout exceeded.')
> pexpect.exceptions.TIMEOUT: Timeout exceeded.
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 119,
> in expect_loop
>     return self.timeout(e)
>   File "/usr/local/lib/python3.6/dist-packages/pexpect/expect.py", line 82, in
> timeout
>     raise TIMEOUT(msg)
> pexpect.exceptions.TIMEOUT: Timeout exceeded.
> <pexpect.pxssh.pxssh object at 0x70b17a7c1be0>
> command: /usr/bin/ssh
> args: [b'/usr/bin/ssh', b'-q', b'-l', b'root', b'9.114.224.16'] buffer (last 100
> chars): ''
> .......
> 
> Signed-off-by: Thinh Tran <thinhtr@linux.vnet.ibm.com>
> ---
>  framework/ssh_pexpect.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py index
> df610c1..0230207 100644
> --- a/framework/ssh_pexpect.py
> +++ b/framework/ssh_pexpect.py
> @@ -133,7 +133,7 @@ class SSHPexpect:
> 
>      def __prompt(self, command, timeout):
>          if not self.session.prompt(timeout):
> -            raise TimeoutException(command, self.get_output_all())
> +            raise TimeoutException(command, self.get_output_all()) from
> + None
> 
>      def __sendline(self, command):
>          if not self.isalive():
> --
> 2.17.0


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

end of thread, other threads:[~2020-05-19  2:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 21:18 [dts] [PATCH] framework: handling _prompt and ssh exceptions Thinh Tran
2020-05-19  2:00 ` Tu, Lijuan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).