From patchwork Mon Oct 25 09:05:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 102758 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 E0068A0C45; Mon, 25 Oct 2021 11:06:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CFE5D40E32; Mon, 25 Oct 2021 11:06:00 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id B868A4003E for ; Mon, 25 Oct 2021 11:05:58 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10147"; a="228366186" X-IronPort-AV: E=Sophos;i="5.87,179,1631602800"; d="scan'208";a="228366186" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2021 02:05:57 -0700 X-IronPort-AV: E=Sophos;i="5.87,179,1631602800"; d="scan'208";a="496710959" Received: from unknown (HELO dpdk-zhaohy-t.sh.intel.com) ([10.240.183.68]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2021 02:05:56 -0700 From: Jiale Song To: dts@dpdk.org Cc: Jiale Song Date: Mon, 25 Oct 2021 17:05:48 +0800 Message-Id: <1635152748-95420-1-git-send-email-songx.jiale@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dts] [PATCH V3] tests/link_status_interrupt: optimize link-down-on-close checking method 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 Sender: "dts" some nic no link-down-on-close Signed-off-by: Jiale Song --- tests/TestSuite_link_status_interrupt.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/TestSuite_link_status_interrupt.py b/tests/TestSuite_link_status_interrupt.py index bdb43f42..b58099b0 100755 --- a/tests/TestSuite_link_status_interrupt.py +++ b/tests/TestSuite_link_status_interrupt.py @@ -79,14 +79,16 @@ class TestLinkStatusInterrupt(TestCase): set_flag = "ethtool --set-priv-flags %s %s on" % (intf, self.flag) out = self.tester.send_expect(check_flag, "#") p = re.compile('%s\s+:\s+(\w+)' % self.flag) - res = re.search(p, out).group(1) - if res == "off": - self.tester.send_expect(set_flag, "#") - time.sleep(0.5) - out = self.tester.send_expect(check_flag, "#") - self.verify(re.search(p, out).group(1) == "on", "set %s %s on failed" % (intf, self.flag)) - elif not res: - self.logger.info("NIC %s might not support this case" % intf) + match = re.search(p, out) + if match: + res = match.group(1) + if res == "off": + self.tester.send_expect(set_flag, "#") + time.sleep(0.5) + out = self.tester.send_expect(check_flag, "#") + self.verify(re.search(p, out).group(1) == "on", "set %s %s on failed" % (intf, self.flag)) + elif not res: + self.logger.info("NIC %s might not support this case" % intf) def set_link_status_and_verify(self, dutPort, status): """