From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F187A0471 for ; Thu, 15 Aug 2019 09:58:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 531FD5681; Thu, 15 Aug 2019 09:58:42 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 19F2637B7 for ; Thu, 15 Aug 2019 09:58:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Aug 2019 00:58:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,388,1559545200"; d="scan'208";a="188428864" Received: from dpdk-lihong-ub1604.sh.intel.com ([10.67.119.68]) by orsmga002.jf.intel.com with ESMTP; 15 Aug 2019 00:58:37 -0700 From: lihong To: dts@dpdk.org Cc: lihong Date: Thu, 15 Aug 2019 08:35:28 +0800 Message-Id: <1565829328-25552-1-git-send-email-lihongx.ma@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dts] [PATCH V1] tests: add absolute path for pcap file to support trex X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 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" Signed-off-by: lihong --- tests/TestSuite_pvp_share_lib.py | 19 +++++++++------- ...TestSuite_pvp_vhost_user_built_in_net_driver.py | 26 ++++++++++++++-------- tests/TestSuite_pvp_virtio_user_2M_hugepages.py | 18 ++++++++------- ...stSuite_virtio_user_for_container_networking.py | 18 ++++++++------- 4 files changed, 48 insertions(+), 33 deletions(-) diff --git a/tests/TestSuite_pvp_share_lib.py b/tests/TestSuite_pvp_share_lib.py index d85d79d..f117fd5 100644 --- a/tests/TestSuite_pvp_share_lib.py +++ b/tests/TestSuite_pvp_share_lib.py @@ -49,15 +49,13 @@ class TestPVPShareLib(TestCase): self.core_config = "1S/4C/1T" self.dut_ports = self.dut.get_ports() self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) - self.cores_num = len([n for n in self.dut.cores if int(n['socket']) == - self.ports_socket]) + self.core_list = self.dut.get_core_list( + self.core_config, socket=self.ports_socket) self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing") - self.verify(self.cores_num >= 4, + self.verify(len(self.core_list) >= 4, "There has not enought cores to test this suite %s" % self.suite_name) - self.core_list = self.dut.get_core_list( - self.core_config, socket=self.ports_socket) self.core_list_virtio_user = self.core_list[0:2] self.core_list_vhost_user = self.core_list[2:4] self.core_mask_virtio_user = utils.create_mask(self.core_list_virtio_user) @@ -65,6 +63,11 @@ class TestPVPShareLib(TestCase): self.mem_channels = self.dut.get_memory_channels() self.dst_mac = self.dut.get_mac_address(self.dut_ports[0]) self.prepare_share_lib_env() + + self.out_path = '/tmp' + out = self.tester.send_expect('ls -d %s' % self.out_path, '# ') + if 'No such file or directory' in out: + self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') # create an instance to set stream field setting self.pktgen_helper = PacketGeneratorHelper() @@ -105,9 +108,9 @@ class TestPVPShareLib(TestCase): rx_port = self.tester.get_local_port(self.dut_ports[0]) tx_port = self.tester.get_local_port(self.dut_ports[0]) self.tester.scapy_append( - 'wrpcap("vhost.pcap", [Ether(dst="%s")/IP()/TCP()/("X"*%d)])' % - (self.dst_mac, payload_size)) - tgen_input.append((tx_port, rx_port, "vhost.pcap")) + 'wrpcap("%s/vhost.pcap", [Ether(dst="%s")/IP()/TCP()/("X"*%d)])' % + (self.out_path, self.dst_mac, payload_size)) + tgen_input.append((tx_port, rx_port, "%s/vhost.pcap" % self.out_path)) self.tester.scapy_execute() self.tester.pktgen.clear_streams() diff --git a/tests/TestSuite_pvp_vhost_user_built_in_net_driver.py b/tests/TestSuite_pvp_vhost_user_built_in_net_driver.py index 1f560ae..52d9df9 100644 --- a/tests/TestSuite_pvp_vhost_user_built_in_net_driver.py +++ b/tests/TestSuite_pvp_vhost_user_built_in_net_driver.py @@ -39,6 +39,7 @@ import re from test_case import TestCase from settings import HEADER_SIZE from pktgen import PacketGeneratorHelper +from pmd_output import PmdOutput class TestPVPVhostUserBuiltInNetDriver(TestCase): @@ -51,15 +52,13 @@ class TestPVPVhostUserBuiltInNetDriver(TestCase): self.core_config = "1S/4C/1T" self.dut_ports = self.dut.get_ports() self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) - self.cores_num = len([n for n in self.dut.cores if int(n['socket']) == - self.ports_socket]) + self.core_list = self.dut.get_core_list( + self.core_config, socket=self.ports_socket) self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing") - self.verify(self.cores_num >= 4, + self.verify(len(self.core_list) >= 4, "There has not enought cores to test this suite %s" % self.suite_name) - self.core_list = self.dut.get_core_list( - self.core_config, socket=self.ports_socket) self.core_list_virtio_user = self.core_list[0:2] self.core_list_vhost_user = self.core_list[2:4] self.core_mask_virtio_user = utils.create_mask(self.core_list_virtio_user) @@ -72,6 +71,11 @@ class TestPVPVhostUserBuiltInNetDriver(TestCase): " in region 'suite' like packet_sizes=[64, 128, 256]") if 'packet_sizes' in self.get_suite_cfg(): self.frame_sizes = self.get_suite_cfg()['packet_sizes'] + + self.out_path = '/tmp' + out = self.tester.send_expect('ls -d %s' % self.out_path, '# ') + if 'No such file or directory' in out: + self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') # create an instance to set stream field setting self.pktgen_helper = PacketGeneratorHelper() @@ -85,6 +89,7 @@ class TestPVPVhostUserBuiltInNetDriver(TestCase): self.dut.send_expect("killall -s INT testpmd", "# ") self.vhost_switch = self.dut.new_session(suite="vhost-switch") self.virtio_user = self.dut.new_session(suite="virtio-user") + self.pmd_out = PmdOutput(self.dut, self.virtio_user) # Prepare the result table self.virtio_mac = "00:11:22:33:44:10" self.vlan_id = 1000 @@ -125,15 +130,16 @@ class TestPVPVhostUserBuiltInNetDriver(TestCase): rx_port = self.tester.get_local_port(self.dut_ports[0]) tx_port = self.tester.get_local_port(self.dut_ports[0]) self.tester.scapy_append( - 'wrpcap("vhost.pcap", [Ether(dst="%s")/Dot1Q(vlan=%s)/IP()/("X"*%d)])' % - (self.virtio_mac, self.vlan_id, payload_size)) - tgen_input.append((tx_port, rx_port, "vhost.pcap")) + 'wrpcap("%s/vhost.pcap", [Ether(dst="%s")/Dot1Q(vlan=%s)/IP()/("X"*%d)])' % + (self.out_path, self.virtio_mac, self.vlan_id, payload_size)) + tgen_input.append((tx_port, rx_port, "%s/vhost.pcap" % self.out_path)) self.tester.scapy_execute() self.tester.pktgen.clear_streams() streams = self.pktgen_helper.prepare_stream_from_tginput(tgen_input, 100, None, self.tester.pktgen) - _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams) + trans_options={'delay':5, 'duration': 20} + _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=trans_options) Mpps = pps / 1000000.0 self.verify(Mpps > 0, "%s can not receive packets of frame size %d" % (self.running_case, frame_size)) throughput = Mpps * 100 / \ @@ -187,6 +193,8 @@ class TestPVPVhostUserBuiltInNetDriver(TestCase): self.virtio_user.send_expect(command_line_user, "testpmd> ", 120) self.virtio_user.send_expect("set fwd mac", "testpmd> ", 120) self.virtio_user.send_expect("start tx_first", "testpmd> ", 120) + res = self.pmd_out.wait_link_status_up('all') + self.verify(res is True, 'There has port link is down') def close_all_apps(self): """ diff --git a/tests/TestSuite_pvp_virtio_user_2M_hugepages.py b/tests/TestSuite_pvp_virtio_user_2M_hugepages.py index 56f285a..5531e0b 100644 --- a/tests/TestSuite_pvp_virtio_user_2M_hugepages.py +++ b/tests/TestSuite_pvp_virtio_user_2M_hugepages.py @@ -52,15 +52,13 @@ class TestPVPVirtioWith2Mhuge(TestCase): self.core_config = "1S/4C/1T" self.dut_ports = self.dut.get_ports() self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) - self.cores_num = len([n for n in self.dut.cores if int(n['socket']) == - self.ports_socket]) + self.core_list = self.dut.get_core_list( + self.core_config, socket=self.ports_socket) self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing") - self.verify(self.cores_num >= 4, + self.verify(len(self.core_list) >= 4, "There has not enought cores to test this suite %s" % self.suite_name) - self.core_list = self.dut.get_core_list( - self.core_config, socket=self.ports_socket) self.core_list_virtio_user = self.core_list[0:2] self.core_list_vhost_user = self.core_list[2:4] self.core_mask_virtio_user = utils.create_mask(self.core_list_virtio_user) @@ -73,6 +71,10 @@ class TestPVPVirtioWith2Mhuge(TestCase): " in region 'suite' like packet_sizes=[64, 128, 256]") if 'packet_sizes' in self.get_suite_cfg(): self.frame_sizes = self.get_suite_cfg()['packet_sizes'] + self.out_path = '/tmp' + out = self.tester.send_expect('ls -d %s' % self.out_path, '# ') + if 'No such file or directory' in out: + self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') # create an instance to set stream field setting self.pktgen_helper = PacketGeneratorHelper() @@ -102,9 +104,9 @@ class TestPVPVirtioWith2Mhuge(TestCase): rx_port = self.tester.get_local_port(self.dut_ports[0]) tx_port = self.tester.get_local_port(self.dut_ports[0]) self.tester.scapy_append( - 'wrpcap("vhost.pcap", [Ether(dst="%s")/IP()/TCP()/("X"*%d)])' % - (self.dst_mac, payload_size)) - tgen_input.append((tx_port, rx_port, "vhost.pcap")) + 'wrpcap("%s/vhost.pcap", [Ether(dst="%s")/IP()/TCP()/("X"*%d)])' % + (self.out_path, self.dst_mac, payload_size)) + tgen_input.append((tx_port, rx_port, "%s/vhost.pcap" % self.out_path)) self.tester.scapy_execute() self.tester.pktgen.clear_streams() diff --git a/tests/TestSuite_virtio_user_for_container_networking.py b/tests/TestSuite_virtio_user_for_container_networking.py index c914a88..241d5b0 100644 --- a/tests/TestSuite_virtio_user_for_container_networking.py +++ b/tests/TestSuite_virtio_user_for_container_networking.py @@ -53,8 +53,6 @@ class TestVirtioUserForContainer(TestCase): self.dut_ports = self.dut.get_ports() self.mem_channels = self.dut.get_memory_channels() self.ports_socket = self.dut.get_numa_id(self.dut_ports[0]) - self.cores_num = len([n for n in self.dut.cores if int(n['socket']) == - self.ports_socket]) self.verify(len(self.dut_ports) >= 1, 'Insufficient ports for testing') self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + HEADER_SIZE['udp'] @@ -67,6 +65,10 @@ class TestVirtioUserForContainer(TestCase): " in region 'suite' like packet_sizes=[64, 128, 256]") if 'packet_sizes' in self.get_suite_cfg(): self.frame_sizes = self.get_suite_cfg()['packet_sizes'] + self.out_path = '/tmp' + out = self.tester.send_expect('ls -d %s' % self.out_path, '# ') + if 'No such file or directory' in out: + self.tester.send_expect('mkdir -p %s' % self.out_path, '# ') # create an instance to set stream field setting self.pktgen_helper = PacketGeneratorHelper() @@ -89,11 +91,11 @@ class TestVirtioUserForContainer(TestCase): def get_core_mask(self): core_config = '1S/%dC/1T' % (self.nb_cores*2 + 2) - self.verify(self.cores_num >= (self.nb_cores*2 + 2), - 'There has not enought cores to test this case %s' % - self.running_case) core_list = self.dut.get_core_list( core_config, socket=self.ports_socket) + self.verify(len(core_list) >= (self.nb_cores*2 + 2), + 'There has not enought cores to test this case %s' % + self.running_case) core_list_vhost_user = core_list[0:self.nb_cores+1] core_list_virtio_user = core_list[self.nb_cores+1:self.nb_cores*2+2] self.core_mask_vhost_user = utils.create_mask(core_list_vhost_user) @@ -109,9 +111,9 @@ class TestVirtioUserForContainer(TestCase): rx_port = self.tester.get_local_port(self.dut_ports[0]) tx_port = self.tester.get_local_port(self.dut_ports[0]) self.tester.scapy_append( - 'wrpcap("vhost.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % - (self.virtio_mac, payload_size)) - tgen_input.append((tx_port, rx_port, "vhost.pcap")) + 'wrpcap("%s/vhost.pcap", [Ether(dst="%s")/IP()/UDP()/("X"*%d)])' % + (self.out_path, self.virtio_mac, payload_size)) + tgen_input.append((tx_port, rx_port, "%s/vhost.pcap" % self.out_path)) self.tester.scapy_execute() self.tester.pktgen.clear_streams() -- 2.7.4