From: Jun Dong <junx.dong@intel.com>
To: dts@dpdk.org
Cc: lijuan.tu@intel.com, qingx.sun@intel.com, junx.dong@intel.com
Subject: [dts] [V1] framework/*: modify command line that list opened files
Date: Wed, 18 May 2022 13:46:36 +0800 [thread overview]
Message-ID: <20220518054636.1416-1-junx.dong@intel.com> (raw)
In some framework scenario, needing to use lsof command to query opened
files that occupied specific ports and to do something about the it. now
add -n options to the command to skip reverse resolution of domain name
when querying to avoid timeout in network offline env.
Signed-off-by: Jun Dong <junx.dong@intel.com>
---
framework/dut.py | 2 +-
framework/qemu_kvm.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/framework/dut.py b/framework/dut.py
index 6a8fc957..82b8fb01 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -1345,7 +1345,7 @@ class Dut(Crb):
port.enable_ipv6()
def check_port_occupied(self, port):
- out = self.alt_session.send_expect("lsof -i:%d" % port, "# ")
+ out = self.alt_session.send_expect("lsof -n -i:%d" % port, "# ")
if out == "":
return False
else:
diff --git a/framework/qemu_kvm.py b/framework/qemu_kvm.py
index 5615263b..b617c389 100644
--- a/framework/qemu_kvm.py
+++ b/framework/qemu_kvm.py
@@ -1115,7 +1115,7 @@ class QEMUKvm(VirtBase):
if connected failed will return None
"""
shell_reg = r"(.*)# "
- scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'" % self.serial_port
+ scan_cmd = "lsof -n -i:%d | grep telnet | awk '{print $2}'" % self.serial_port
try:
# assume serial is not connect
@@ -1910,7 +1910,7 @@ class QEMUKvm(VirtBase):
pass
self.host_dut.send_expect("", "# ")
elif self.control_type == "telnet":
- scan_cmd = "lsof -i:%d | grep telnet | awk '{print $2}'" % self.serial_port
+ scan_cmd = "lsof -n -i:%d | grep telnet | awk '{print $2}'" % self.serial_port
proc_info = self.host_dut.send_expect(scan_cmd, "#")
try:
pid = int(proc_info)
--
2.33.1.windows.1
next reply other threads:[~2022-05-18 5:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-18 5:46 Jun Dong [this message]
2022-05-18 14:08 ` lijuan.tu
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=20220518054636.1416-1-junx.dong@intel.com \
--to=junx.dong@intel.com \
--cc=dts@dpdk.org \
--cc=lijuan.tu@intel.com \
--cc=qingx.sun@intel.com \
/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).