From patchwork Thu Jun 29 08:37:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ling, WeiX" X-Patchwork-Id: 129104 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 BCD8442D8A; Thu, 29 Jun 2023 10:38:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DE5C40EDB; Thu, 29 Jun 2023 10:38:06 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 3AA28406B7 for ; Thu, 29 Jun 2023 10:38:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1688027885; x=1719563885; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=FKdu5XOCekV5pIBfc+0a505yhMCR51K3jwL1kEE6Llk=; b=n/Ca2rmr1Ju7SQJQI6eNRrxEMtPo0RWMzxxWNiW+HKWc5ZXFv/lQIhmh 9VH0HN0WGV0Yb3VxGquFTHh8naWknZAnRhPtmySgPNbHVhCJpPWVqxlxx D5l4gnRCCi2I814sjyIV2XJO2pdd4HJjuFTwYaby8r6g/xT8mekkP0on1 PMXr/imyRWjpbcbr8qHJKRXlTRfsghkE5hGp+7VAOky9MW1n9DCcswc9A JEhm/AcN8c2O3uJax0/XrKzoYhS2xRy9WfRwe2h0czSbaTbo9bDQ1UNUg ehVCL5W6ZwVh+UNphADDDevq7Mt7tZQhzBTP5EFAmY+bpMIYoB+aezs2C w==; X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="341636838" X-IronPort-AV: E=Sophos;i="6.01,168,1684825200"; d="scan'208";a="341636838" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2023 01:38:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10755"; a="752572154" X-IronPort-AV: E=Sophos;i="6.01,168,1684825200"; d="scan'208";a="752572154" Received: from unknown (HELO dut222..) ([10.239.252.222]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jun 2023 01:38:01 -0700 From: Wei Ling To: dts@dpdk.org Cc: Wei Ling Subject: [dts][PATCH V2] tests/ntb: add support host and client pic list option in launch_ntb_fwd() Date: Thu, 29 Jun 2023 16:37:52 +0800 Message-Id: <20230629083752.632829-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 --- v1: 1)Add support host and client pic list option in launch_ntb_fwd() function. 2)Optimize the send_file_and_verify() to check the print info. v2: 1)Add `-- -i ` to enter the interactive mode when start dpdk-ntb in testsuite sync with testplan. 2)Add `--` before params, such as `--buf-size=65407` `--burst=32` in testsuite sync with testplan. tests/TestSuite_ntb.py | 57 ++++++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/tests/TestSuite_ntb.py b/tests/TestSuite_ntb.py index 38d36689..72121ebd 100644 --- a/tests/TestSuite_ntb.py +++ b/tests/TestSuite_ntb.py @@ -114,19 +114,21 @@ 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 """ - cmd_opt = " ".join(["{}={}".format(key, param[key]) for key in param.keys()]) + cmd_opt = "-- -i " + " ".join( + ["--{}={}".format(key, param[key]) for key in param.keys()] + ) 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 +221,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 +274,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 +286,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 +301,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()