From patchwork Fri Sep 24 01:43:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jiale, SongX" X-Patchwork-Id: 99502 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 3339CA0C43; Fri, 24 Sep 2021 03:29:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07A0F40687; Fri, 24 Sep 2021 03:29:55 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id DD34240142 for ; Fri, 24 Sep 2021 03:29:53 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10116"; a="309535906" X-IronPort-AV: E=Sophos;i="5.85,318,1624345200"; d="scan'208";a="309535906" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2021 18:29:52 -0700 X-IronPort-AV: E=Sophos;i="5.85,318,1624345200"; d="scan'208";a="475810680" Received: from unknown (HELO dpdk-zhaohy-t.sh.intel.com) ([10.240.183.68]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2021 18:29:50 -0700 From: Jiale Song To: dts@dpdk.org Cc: Jiale Song Date: Fri, 24 Sep 2021 09:43:02 +0800 Message-Id: <1632447782-136897-1-git-send-email-songx.jiale@intel.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dts] [PATCH V1] tests/link_status_interrupt: add link-down-on-close status check and close it 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" since the link-down-on-close of the tester is turned on, but not closed, the subsequent tests are affected Signed-off-by: Jiale Song --- tests/TestSuite_link_status_interrupt.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) mode change 100644 => 100755 tests/TestSuite_link_status_interrupt.py diff --git a/tests/TestSuite_link_status_interrupt.py b/tests/TestSuite_link_status_interrupt.py old mode 100644 new mode 100755 index 2e8c282..5590d94 --- a/tests/TestSuite_link_status_interrupt.py +++ b/tests/TestSuite_link_status_interrupt.py @@ -70,6 +70,22 @@ class TestLinkStatusInterrupt(TestCase): self.basic_intr_mode = ["msix", "legacy"] if self.drivername == "vfio-pci": self.basic_intr_mode.append("msi") + self.intfs = [self.tester.get_interface(self.tester.get_local_port(i)) for i in self.dut_ports] + # check link-down-on-close flag + self.flag = "link-down-on-close" + for intf in self.intfs: + check_flag = "ethtool --show-priv-flags %s" % intf + 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) def set_link_status_and_verify(self, dutPort, status): """ @@ -193,4 +209,6 @@ class TestLinkStatusInterrupt(TestCase): """ Run after each test suite. """ - pass + if self.dut.get_os_type() != 'freebsd': + for intf in self.intfs: + self.tester.send_expect("ethtool --set-priv-flags %s %s off" % (intf, self.flag), "#", 10)