From patchwork Wed Jan 26 12:39:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiang X-Patchwork-Id: 106528 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 67ADBA0352; Wed, 26 Jan 2022 05:39:40 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E118B426D3; Wed, 26 Jan 2022 05:39:39 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 99CD14069D for ; Wed, 26 Jan 2022 05:39:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643171978; x=1674707978; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MMifA4AYvrfaQjblC/EvJk2gs+SEC5yR5P9vp6sjT3I=; b=TxGpX3ofKtE74hasWUtiCp6/VyV0PysN9yZ2gvmvqA7FH7KzW0pyLc4Q c35A9pNQXFDekP6X2KNQ45QJWKXx+O3SCJkq1O9KaZphk/RAtRYxX5fAM PXkxdj2wBObvm4q3kTfb249yOhrFJ+p3WLlGmzQf0yz4hvtQmXqxDteYo WsLXm+Rqg0WcYxp9VB+RnvGdr/WNJ07X83fquNSBdUzIQs8uPYCjqiQHC BCpXsW3Ce8Akz3YQ6pQuKo8N1SM7ovf9AWWLPy5ASuD35kMNrZwORpQkz ImNCt5/NcZJP5euUBmReoBVxnnx4bZV6hkqQ0/eiB+g7cZOEaoNMaq/4Z g==; X-IronPort-AV: E=McAfee;i="6200,9189,10238"; a="246259133" X-IronPort-AV: E=Sophos;i="5.88,316,1635231600"; d="scan'208";a="246259133" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 20:39:38 -0800 X-IronPort-AV: E=Sophos;i="5.88,316,1635231600"; d="scan'208";a="535037975" Received: from unknown (HELO localhost.localdomain) ([10.239.251.226]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 20:39:36 -0800 From: Yu Jiang To: lijuan.tu@intel.com, dts@dpdk.org Cc: Yu Jiang Subject: [dts][PATCH V1 1/2] tests/hotplug_mp: wait for interface up Date: Wed, 26 Jan 2022 12:39:28 +0000 Message-Id: <20220126123929.2256052-2-yux.jiang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126123929.2256052-1-yux.jiang@intel.com> References: <20220126123929.2256052-1-yux.jiang@intel.com> 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 use new method: is_interface_up to replace redundant code, ensure link up. Signed-off-by: Yu Jiang --- tests/TestSuite_hotplug_mp.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/TestSuite_hotplug_mp.py b/tests/TestSuite_hotplug_mp.py index 11f58d3c..ce7de869 100644 --- a/tests/TestSuite_hotplug_mp.py +++ b/tests/TestSuite_hotplug_mp.py @@ -54,7 +54,7 @@ class TestHotplugMp(TestCase): self.intf0 = self.dut.ports_info[0]['intf'] self.pci0 = self.dut.ports_info[0]['pci'] out = self.dut.build_dpdk_apps("./examples/multi_process/hotplug_mp") - self.app_path=self.dut.apps_name['hotplug_mp'] + self.app_path = self.dut.apps_name['hotplug_mp'] self.verify('Error' not in out, "Compilation failed") # Start one new session to run primary process self.session_pri = self.dut.new_session() @@ -221,9 +221,7 @@ class TestHotplugMp(TestCase): """ if not iface: self.dut.send_expect("ifconfig %s up" % self.intf0, "#") - time.sleep(5) - out = self.dut.send_expect("ethtool %s" % self.intf0, "#") - self.verify("Link detected: yes" in out, "Wrong link status") + self.verify(self.dut.is_interface_up(intf=self.intf0), "Wrong link status") self.multi_process_setup() for i in range(test_loop): @@ -359,7 +357,7 @@ class TestHotplugMp(TestCase): """ vdev = "net_virtio_user0" self.path = "/home/vhost-net" - pmd_path=self.dut.apps_name['test-pmd'] + pmd_path = self.dut.apps_name['test-pmd'] self.session_vhost.send_expect("rm -rf %s" % self.path, "#") eal_param = self.dut.create_eal_parameters(no_pci=True, prefix='vhost',vdevs=["eth_vhost0,iface=%s" % self.path]) param = ' -- -i' From patchwork Wed Jan 26 12:39:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiang X-Patchwork-Id: 106529 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 1B471A04A5; Wed, 26 Jan 2022 05:39:41 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09AF641C3D; Wed, 26 Jan 2022 05:39:41 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 1E010426E3 for ; Wed, 26 Jan 2022 05:39:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643171980; x=1674707980; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OlFPxcmz4Sy2bWKm+HQ3C227euN3kFhg3ZbIjU7bFxE=; b=GWZnIEjWCnGa74uayJWw1Qh3Clh9oeOqgCyom42tf4Vp3JqcAPrPDc9w 680bQk9EpimdH6jiz8UTjV8BqaGjqz01czlKZfaONn0U2LUuPaMLDOCmA QqsV4EQkxNk0jYeF5d7sK827TOALw2/qZQ6IdZibWYaqm2u/ePVhKLs3c 3I5LUlNJ8n1CaeqAJtN+tj9r+LXZwGmN/vR66Bvq8Y/W8Ogpw+RKAvbZp gC7gXoeMcBam+r861qSzwpHvvvnOSHB9gHn7kETc7m8zjEgHLStC1ZrCF VOACExn1NH8ZDNx86pe6Wlko8R+B6C5UyyLWEjlpMwLnUhQf2Ou9WSg9W A==; X-IronPort-AV: E=McAfee;i="6200,9189,10238"; a="246259138" X-IronPort-AV: E=Sophos;i="5.88,316,1635231600"; d="scan'208";a="246259138" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 20:39:39 -0800 X-IronPort-AV: E=Sophos;i="5.88,316,1635231600"; d="scan'208";a="535037982" Received: from unknown (HELO localhost.localdomain) ([10.239.251.226]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 20:39:38 -0800 From: Yu Jiang To: lijuan.tu@intel.com, dts@dpdk.org Cc: Yu Jiang Subject: [dts][PATCH V1 2/2] tests/shutdown_api: wait for interface/link up Date: Wed, 26 Jan 2022 12:39:29 +0000 Message-Id: <20220126123929.2256052-3-yux.jiang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126123929.2256052-1-yux.jiang@intel.com> References: <20220126123929.2256052-1-yux.jiang@intel.com> 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 1, use new method: is_interface_up/down to replace redundant code, ensure link up/down. 2, add tester's link check before send package. 3, add testpmd's wait_link_status_up to ensure port is up. Signed-off-by: Yu Jiang Tested-by: Jiale Song < songx.jiale@intel.com> --- tests/TestSuite_shutdown_api.py | 42 ++++++++++----------------------- 1 file changed, 12 insertions(+), 30 deletions(-) diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py index 9f40d232..d8448c39 100644 --- a/tests/TestSuite_shutdown_api.py +++ b/tests/TestSuite_shutdown_api.py @@ -105,6 +105,9 @@ class TestShutdownApi(TestCase): if ports is None: ports = self.ports if len(ports) == 1: + # check tester's link status before send pkg + tester_intf = self.tester.get_interface(self.tester.get_local_port(ports[0])) + self.tester.is_interface_up(intf=tester_intf) self.send_packet(ports[0], ports[0], pktSize, received, vlan, promisc, allmulti, vlan_strip) return @@ -177,16 +180,14 @@ class TestShutdownApi(TestCase): def check_ports(self, status=True): """ - Check link status of the ports. + Check link status of the ports from tester side. """ for port in self.ports: - out = self.tester.send_expect( - "ethtool %s" % self.tester.get_interface(self.tester.get_local_port(port)), "# ") + tester_intf = self.tester.get_interface(self.tester.get_local_port(port)) if status: - self.verify("Link detected: yes" in out, "Wrong link status") + self.verify(self.tester.is_interface_up(intf=tester_intf), "Wrong link status, should be up") else: - self.verify("Link detected: no" in out, "Wrong link status") - + self.verify(self.tester.is_interface_down(intf=tester_intf), "Wrong link status, should be down") def check_linkspeed_config(self, configs): ret_val = False @@ -206,15 +207,7 @@ class TestShutdownApi(TestCase): def check_vf_link_status(self): self.vm0_testpmd.start_testpmd(VM_CORES_MASK, '--port-topology=chained') - time.sleep(2) - for i in range(15): - out = self.vm0_testpmd.execute_cmd('show port info 0') - print(out) - if 'Link status: down' in out: - time.sleep(2) - else : - break - self.verify("Link status: up" in out, "VF link down!!!") + self.vm0_testpmd.wait_link_status_up('all') def setup_vm_env(self, driver='default'): """ @@ -266,7 +259,6 @@ class TestShutdownApi(TestCase): self.vm_env_done = True - def destroy_vm_env(self): if getattr(self, 'self.vm0_testpmd', None): self.vm0_testpmd.quit() @@ -289,12 +281,8 @@ class TestShutdownApi(TestCase): if not self.vm_env_done: return - self.vm_env_done = False - - - def test_stop_restart(self): """ Stop and Restar. @@ -308,14 +296,11 @@ class TestShutdownApi(TestCase): self.dut.send_expect("stop", "testpmd> ") self.check_forwarding(received=False) self.dut.send_expect("port stop all", "testpmd> ", 100) - time.sleep(5) if self.nic in ["columbiaville_25g", "columbiaville_100g"]: self.check_ports(status=True) else: self.check_ports(status=False) self.dut.send_expect("port start all", "testpmd> ", 100) - time.sleep(5) - self.check_ports(status=True) self.dut.send_expect("start", "testpmd> ") self.check_forwarding() @@ -477,7 +462,8 @@ class TestShutdownApi(TestCase): config[0], config[1].lower()), "testpmd> ") self.dut.send_expect("set fwd mac", "testpmd>") self.dut.send_expect("port start all", "testpmd> ", 100) - time.sleep(8) # sleep few seconds for link stable + # wait NIC link status stable within 15s + self.pmdout.wait_link_status_up('all') for port in self.ports: out = self.dut.send_expect("show port info %s" % port, "testpmd>") @@ -501,6 +487,7 @@ class TestShutdownApi(TestCase): self.dut.send_expect("start", "testpmd> ") self.check_forwarding() self.dut.send_expect("stop", "testpmd> ") + def test_change_linkspeed_vf(self): """ Change Link Speed VF . @@ -561,7 +548,6 @@ class TestShutdownApi(TestCase): self.verify(config[1].lower() == linktype[0].lower(), "Wrong VF link type reported by the self.tester.") - def test_enable_disablejumbo(self): """ Enable/Disable Jumbo Frames. @@ -752,14 +738,12 @@ class TestShutdownApi(TestCase): # link down test for i in range(ports_num): self.dut.send_expect("set link-down port %d" % i, "testpmd>") - # leep few seconds for NIC link status update - time.sleep(5) + # check NIC link status update within 15s self.check_ports(status=False) # link up test for j in range(ports_num): self.dut.send_expect("set link-up port %d" % j, "testpmd>") - time.sleep(5) self.check_ports(status=True) self.check_forwarding() @@ -815,8 +799,6 @@ class TestShutdownApi(TestCase): # start ports, to avodi failing further tests if ports are stoped self.dut.send_expect("port start all", "testpmd> ", 100) self.dut.send_expect("quit", "# ") - - def tear_down_all(self): """