From patchwork Wed May 18 05:46:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Dong X-Patchwork-Id: 111266 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D91D6A0503; Wed, 18 May 2022 07:46:47 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AEBBF4068B; Wed, 18 May 2022 07:46:47 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id EBC7D40685 for ; Wed, 18 May 2022 07:46:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652852806; x=1684388806; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=5X3oo0Xd6WTbjk0EJnxxeWNxEqBL1M6mdyQ7xlqoQ4E=; b=k52MhOXxaq0y41BYyi3HfGRQlYN8FALeSDSYO7F4h4nxfNqeEgEEfnYO 9enyYK8SKjSpL/zzZNHBcaSmaqqbpCxmRy/omvyuhjvOFU02GKJmw6OL0 cdmERAx5Ha08cDp9B44aMUHWHyFIUhhoYT6Pa0CLz3Y2LG0WAj1J+re7i 0JyF4c8qp/lq/xW6Sssftl1FoCaVtqHuyAtUrKCZi8uWudR9yr09aj9dE sHvC+sysBSy+eocuRwBIGhPWLm3BAyW8B1dJlzkPCa1GoWeK6Wh9Shrpc TTbu2vt0LFlh61ZXWUyCW6iV+Ozx4PDY+DOGcAipVZueSf2xvvV5mYoNM Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10350"; a="334536638" X-IronPort-AV: E=Sophos;i="5.91,234,1647327600"; d="scan'208";a="334536638" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 22:46:44 -0700 X-IronPort-AV: E=Sophos;i="5.91,234,1647327600"; d="scan'208";a="898048036" Received: from shwdenpg197.ccr.corp.intel.com ([10.253.109.70]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2022 22:46:42 -0700 From: Jun Dong 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 Message-Id: <20220518054636.1416-1-junx.dong@intel.com> X-Mailer: git-send-email 2.33.1.windows.1 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org 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 --- 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)