From patchwork Tue Jun 27 05:34:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 129010 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 E0CA842D6C; Tue, 27 Jun 2023 07:34:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB7FA4113F; Tue, 27 Jun 2023 07:34:26 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id E5FCD40F18 for ; Tue, 27 Jun 2023 07:34:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687844065; x=1719380065; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=LtK7cKCYNfFyolDcNp09fGDC+SvejyZQ5CKFyR0FTCw=; b=hGs6Ch0dwcDRADL56eCSEy6scn830if6sHJrOfDu5svfvd4a2b06bnVH KxRWHb1Bplxjrl8nFmIcTmghg0chzMtx832YXBeMMqAWc2MFyC8cOBYG3 6iT7ULPM6km8uyqBpn7MNelSYG5yzuqwb3lT+fX9ucDEZdJ3Lt7Cp5Ed+ gaTBLkd8obC8VDQH+FgAH2qcwNvgViBE2mcRAmT0wIEOqH6wTVO3Js4ZL F7aCuEE3pXmP1g8Yxi4QRdVT7bTXthTtNs8MlMpL33ykSy+dKWuts3ve+ ZapvrYdJniP++1GYxl1OcH2YpWJc3qEtUbgGYb634T0+wVXF+2sWhAyLS Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10753"; a="346239580" X-IronPort-AV: E=Sophos;i="6.01,161,1684825200"; d="scan'208";a="346239580" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 22:34:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10753"; a="829512522" X-IronPort-AV: E=Sophos;i="6.01,161,1684825200"; d="scan'208";a="829512522" Received: from unknown (HELO dut222..) ([10.239.252.222]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 22:34:12 -0700 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V1] tests/ntb: add support host_ports and client_ports option in launch_ntb_fwd() Date: Tue, 27 Jun 2023 13:34:03 +0800 Message-Id: <20230627053403.609004-1-weix.ling@intel.com> X-Mailer: git-send-email 2.34.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 1.TestCase 1 and 2 only need NTB pci, but testcase 3 need NTB pci and NIC pci to start dpdk-ntb app, so modify the launch_ntb_fwd() function to support host_ports and client_ports option. 2.Optimize the send_file_and_verify() to check the print info after execute `ntb> send /tmp/ntb.txt` command on host ntb server and client ntb server to verify the send and receive file sucessed or not. Signed-off-by: Wei Ling --- tests/TestSuite_ntb.py | 53 ++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 12 deletions(-) diff --git a/tests/TestSuite_ntb.py b/tests/TestSuite_ntb.py index 38d36689..e9b2c2f7 100644 --- a/tests/TestSuite_ntb.py +++ b/tests/TestSuite_ntb.py @@ -114,7 +114,7 @@ class TestNtb(TestCase): ntb = self.get_ntb_port(self.ntb_client) ntb.bind_driver(driver) - def launch_ntb_fwd(self, **param): + def launch_ntb_fwd(self, host_ports, client_ports, **param): """ launch ntb_fwd on ntb host and ntb client """ @@ -123,10 +123,10 @@ class TestNtb(TestCase): self.get_core_list() app = self.dut.apps_name["ntb"] eal_host = self.ntb_host.create_eal_parameters( - cores=self.host_core_list, ports=[self.get_ntb_port(self.ntb_host).pci] + cores=self.host_core_list, ports=host_ports ) eal_client = self.ntb_client.create_eal_parameters( - cores=self.client_core_list, ports=[self.get_ntb_port(self.ntb_client).pci] + cores=self.client_core_list, ports=client_ports ) host_cmd_line = " ".join([app, eal_host, cmd_opt]) client_cmd_line = " ".join([app, eal_client, cmd_opt]) @@ -219,17 +219,34 @@ class TestNtb(TestCase): src_file = "{}/ntb.txt".format(self.out_path) base_dir = self.ntb_client.base_dir.replace("~", "/root") dst_file = "{}/ntb_recv_file0".format(base_dir) - content = "ntb!123" + host_content = "ntb!123" self.ntb_client.alt_session.send_expect("rm {}".format(dst_file), "# ") self.ntb_host.alt_session.send_expect( - "echo '{}' >{}".format(content, src_file), "# " + "echo '{}' >{}".format(host_content, src_file), "# " ) - self.ntb_host.send_expect("send {}".format(src_file), "ntb> ", 30) - time.sleep(3) + # check the print info after send file on NTB host server + host_out = self.ntb_host.send_expect("send {}".format(src_file), "ntb> ", 30) + host_reg = ( + "send {}\r\r\nSending file, size is \d+\r\nDone sending file.".format( + src_file + ) + ) + host_info = re.findall(host_reg, host_out) + self.verify(len(host_info) == 1, "Send File FAILED!") + + # check the print info after send file on NTB client server + client_out = self.ntb_client.get_session_output() + client_reg = " Received file \(size: \d+\) from peer to ntb_recv_file0.\r\n" + client_info = re.findall(client_reg, client_out) + self.verify(len(client_info) == 1, "Recieve File FAILED!") # Check file received on client. - cnt = self.ntb_client.alt_session.send_expect("cat %s" % dst_file, "# ") - self.verify(cnt == content, "the content can't match with the sent") + client_content = self.ntb_client.alt_session.send_expect( + "cat %s" % dst_file, "# " + ) + self.verify( + client_content == host_content, "the content can't match with the sent" + ) def send_pkg_and_verify(self): for frame_size in self.frame_sizes: @@ -255,7 +272,9 @@ class TestNtb(TestCase): self.set_driver(driver) self.ntb_bind_driver(driver) - self.launch_ntb_fwd(**{"buf-size": 65407}) + host_ports = [self.get_ntb_port(self.ntb_host).pci] + client_ports = [self.get_ntb_port(self.ntb_client).pci] + self.launch_ntb_fwd(host_ports, client_ports, **{"buf-size": 65407}) self.start_ntb_fwd_on_dut(self.ntb_host, fwd_mode="file-trans") self.start_ntb_fwd_on_dut(self.ntb_client, fwd_mode="file-trans") self.send_file_and_verify() @@ -265,7 +284,9 @@ class TestNtb(TestCase): self.set_driver(driver) self.ntb_bind_driver(driver) - self.launch_ntb_fwd(**{"buf-size": 65407}) + host_ports = [self.get_ntb_port(self.ntb_host).pci] + client_ports = [self.get_ntb_port(self.ntb_client).pci] + self.launch_ntb_fwd(host_ports, client_ports, **{"buf-size": 65407}) self.start_ntb_fwd_on_dut(self.ntb_host, fwd_mode="rxonly") self.start_ntb_fwd_on_dut(self.ntb_client, fwd_mode="txonly") time.sleep(1) @@ -278,7 +299,15 @@ class TestNtb(TestCase): self.port_bind_driver(driver) self.create_table() - self.launch_ntb_fwd(**{"burst": 32}) + host_ports = [ + self.get_ntb_port(self.ntb_host).pci, + self.ntb_host.ports_info[0]["pci"], + ] + client_ports = [ + self.get_ntb_port(self.ntb_client).pci, + self.ntb_client.ports_info[0]["pci"], + ] + self.launch_ntb_fwd(host_ports, client_ports, **{"burst": 32}) self.start_ntb_fwd_on_dut(self.ntb_host, fwd_mode="iofwd") self.start_ntb_fwd_on_dut(self.ntb_client, fwd_mode="iofwd") self.send_pkg_and_verify()