[V1] framework/*: modify command line that list opened files
Checks
Context |
Check |
Description |
ci/Intel-dts-format-test |
success
|
Testing OK
|
ci/Intel-dts-pylama-test |
success
|
Testing OK
|
ci/Intel-dts-suite-test |
success
|
Testing OK
|
Commit Message
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(-)
Comments
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
@@ -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:
@@ -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)