From: lihong <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: lihong <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1] tests: add absolute path for pcap file to support trex
Date: Thu, 15 Aug 2019 08:35:28 +0800 [thread overview]
Message-ID: <1565829328-25552-1-git-send-email-lihongx.ma@intel.com> (raw)
Signed-off-by: lihong <lihongx.ma@intel.com>
---
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
next reply other threads:[~2019-08-15 7:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-15 0:35 lihong [this message]
2019-08-28 10:40 ` Tu, Lijuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1565829328-25552-1-git-send-email-lihongx.ma@intel.com \
--to=lihongx.ma@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).