test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [V1] framework/*: modify command line that list opened files
@ 2022-05-18  5:46 Jun Dong
  2022-05-18 14:08 ` lijuan.tu
  0 siblings, 1 reply; 2+ messages in thread
From: Jun Dong @ 2022-05-18  5:46 UTC (permalink / raw)
  To: dts; +Cc: lijuan.tu, qingx.sun, junx.dong

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


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

* [dts] [V1] framework/*: modify command line that list opened files
  2022-05-18  5:46 [dts] [V1] framework/*: modify command line that list opened files Jun Dong
@ 2022-05-18 14:08 ` lijuan.tu
  0 siblings, 0 replies; 2+ messages in thread
From: lijuan.tu @ 2022-05-18 14:08 UTC (permalink / raw)
  To: dts, Jun Dong; +Cc: lijuan.tu, qingx.sun, junx.dong

On Wed, 18 May 2022 13:46:36 +0800, Jun Dong <junx.dong@intel.com> wrote:
> 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>


Applied, thanks

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

end of thread, other threads:[~2022-05-18 14:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-18  5:46 [dts] [V1] framework/*: modify command line that list opened files Jun Dong
2022-05-18 14:08 ` lijuan.tu

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).