test suite reviews and discussions
 help / color / mirror / Atom feed
From: Thinh Tran <thinhtr@linux.vnet.ibm.com>
To: dts@dpdk.org
Cc: Thinh Tran <thinhtr@linux.vnet.ibm.com>
Subject: [dts]  [PATCH] framework: handling _prompt and ssh exceptions
Date: Thu, 14 May 2020 17:18:51 -0400	[thread overview]
Message-ID: <20200514211851.73603-1-thinhtr@linux.vnet.ibm.com> (raw)

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


             reply	other threads:[~2020-05-14 21:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 21:18 Thinh Tran [this message]
2020-05-19  2:00 ` Tu, Lijuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200514211851.73603-1-thinhtr@linux.vnet.ibm.com \
    --to=thinhtr@linux.vnet.ibm.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).