From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH 2/4] framework: maintain connected session list and disable debug mode in send_expect
Date: Tue, 28 Apr 2015 22:56:30 +0800 [thread overview]
Message-ID: <1430232992-6798-3-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1430232992-6798-1-git-send-email-yong.liu@intel.com>
From: Marvin Liu <yong.liu@intel.com>
Signed-off-by: Marvin Liu <yong.liu@intel.com>
---
framework/ssh_connection.py | 7 +++++++
framework/ssh_pexpect.py | 10 +++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py
index b10cb4f..18a6517 100644
--- a/framework/ssh_connection.py
+++ b/framework/ssh_connection.py
@@ -32,6 +32,10 @@
from ssh_pexpect import SSHPexpect
from settings import USERNAME
+"""
+Global structure for saving connections
+"""
+CONNECTIONS = []
class SSHConnection(object):
@@ -43,6 +47,9 @@ class SSHConnection(object):
def __init__(self, host, session_name, password=''):
self.session = SSHPexpect(host, USERNAME, password)
self.name = session_name
+ connection = {}
+ connection[self.name] = self.session
+ CONNECTIONS.append(connection)
def init_log(self, logger):
self.logger = logger
diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py
index eaa3a42..735df44 100644
--- a/framework/ssh_pexpect.py
+++ b/framework/ssh_pexpect.py
@@ -1,6 +1,7 @@
import time
import pexpect
import pxssh
+from debugger import ignore_keyintr, aware_keyintr
from exception import TimeoutException, SSHConnectionException
"""
@@ -31,12 +32,15 @@ class SSHPexpect(object):
self.logger.info("ssh %s@%s" % (self.username, self.host))
def send_expect_base(self, command, expected, timeout=15):
- # clear buffer
- self.__flush()
+ ignore_keyintr()
+ self.__flush() # clear buffer
self.session.PROMPT = expected
self.__sendline(command)
self.__prompt(command, timeout)
- return self.get_output_before()
+ aware_keyintr()
+
+ before = self.get_output_before()
+ return before
def send_expect(self, command, expected, timeout=15, verify=False):
ret = self.send_expect_base(command, expected, timeout)
--
1.9.3
next prev parent reply other threads:[~2015-04-28 14:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 14:56 [dts] [PATCH 0/4] Support debug mode in DTS Yong Liu
2015-04-28 14:56 ` [dts] [PATCH 1/4] framework: add debugger module for enable debug in the running process Yong Liu
2015-04-28 14:56 ` Yong Liu [this message]
2015-04-28 14:56 ` [dts] [PATCH 3/4] framework: change alt session name for easy to distinguish Yong Liu
2015-04-28 14:56 ` [dts] [PATCH 4/4] framework: enlarge hugepage number for dpdk2.0 request more memory Yong Liu
2015-05-11 6:25 ` [dts] [PATCH] framework: add argument for debug mode enable and disable Yong Liu
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=1430232992-6798-3-git-send-email-yong.liu@intel.com \
--to=yong.liu@intel.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).