From patchwork Wed Jan 26 14:52:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiang X-Patchwork-Id: 106553 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 8198BA04A6; Wed, 26 Jan 2022 07:52:51 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 401A242702; Wed, 26 Jan 2022 07:52:51 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 2FB674069D for ; Wed, 26 Jan 2022 07:52:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643179970; x=1674715970; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MMifA4AYvrfaQjblC/EvJk2gs+SEC5yR5P9vp6sjT3I=; b=cGMlnjf7cuq3NssgJJfp9ANqMdWQt6Ku46ESHBepyz649Omojbh2xgBa w0rm1K3a6IVQxmY//DA1AaQzMrYnhT5+9mGbpZbGWTcHh0xbrWmhiZFI1 PgxbNkUQd9SKpC7/R/dtyO8a4yPTD23orPkJcpLUdVKNeAoNUQquBdU7p gNvPdkkR/n8CaPLUYRFrivx/qTaKDU0KerAcS/WwaZp1Mc77hWuTFbfCr /FulbjPwbIYvWzMWd2wYm/gI41FRo5Owl1bL3eleBQtxGydQ3D4bb19Gt thxxrIqa1klEWbZPmLtcS8X2/L/7pYJDXpTsUE8p0Y94T4V+ggoDWQWvT w==; X-IronPort-AV: E=McAfee;i="6200,9189,10238"; a="309807449" X-IronPort-AV: E=Sophos;i="5.88,317,1635231600"; d="scan'208";a="309807449" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 22:52:49 -0800 X-IronPort-AV: E=Sophos;i="5.88,317,1635231600"; d="scan'208";a="628212725" Received: from unknown (HELO localhost.localdomain) ([10.239.251.226]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 22:52:48 -0800 From: Yu Jiang To: lijuan.tu@intel.com, dts@dpdk.org Cc: Yu Jiang Subject: [dts][PATCH V2 1/2] tests/hotplug_mp: wait for interface up Date: Wed, 26 Jan 2022 14:52:38 +0000 Message-Id: <20220126145239.2274454-2-yux.jiang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126145239.2274454-1-yux.jiang@intel.com> References: <20220126145239.2274454-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 14:52:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Jiang X-Patchwork-Id: 106554 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 602B0A04A5; Wed, 26 Jan 2022 07:52:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5BE4842701; Wed, 26 Jan 2022 07:52:53 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id DD98C4069D for ; Wed, 26 Jan 2022 07:52:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643179972; x=1674715972; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MZz8AKJH2TOm/a9G2USGp0u1quqxHHD7EEO5xFwRBAw=; b=DyRI3XogruKZkotrX2yhM3sb4VFy26u2YI7bkBm98Nm4n9YktgXWFqE4 ev+ZGBzSyfbOWF+FqBraBjoXAcPMQ7cSYebXLiY9aFty83W/JGeaWzlu/ rPMP2YR5PxIzQvOmq036WAJM7Clo51JulTsULzopvK9OY9YF1hXi3pkAZ SDQ6V8WKdEYULukL7X3MJyDpe01YaBKiAngbHb/UwKiD4y1tLvE8Umyy1 +pOO400XJnamrY1y1NG43velUCghZbURwzua+6sVemq+a/yQ0EZTO/Zvn vtL09zdiX0+rmNv5d4c0vInYLIJBSwLKU7GbAPrryKRnQ6T/pOonf/lX/ w==; X-IronPort-AV: E=McAfee;i="6200,9189,10238"; a="309807453" X-IronPort-AV: E=Sophos;i="5.88,317,1635231600"; d="scan'208";a="309807453" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 22:52:51 -0800 X-IronPort-AV: E=Sophos;i="5.88,317,1635231600"; d="scan'208";a="628212732" Received: from unknown (HELO localhost.localdomain) ([10.239.251.226]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jan 2022 22:52:50 -0800 From: Yu Jiang To: lijuan.tu@intel.com, dts@dpdk.org Cc: Yu Jiang Subject: [dts][PATCH V2 2/2] tests/shutdown_api: wait for interface/link up Date: Wed, 26 Jan 2022 14:52:39 +0000 Message-Id: <20220126145239.2274454-3-yux.jiang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220126145239.2274454-1-yux.jiang@intel.com> References: <20220126145239.2274454-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> --- v2: add self.verify for check tester's link up before send package. 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..375918b7 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.verify(self.tester.is_interface_up(intf=tester_intf), "Wrong link status, should be up") 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): """