test suite reviews and discussions
 help / color / Atom feed
* [dts] [PATCH V1] tests/pvp_diff_qemu_version: update code to support trex
@ 2019-08-13 22:37 lihong
  2019-08-20  2:37 ` Wang, Yinan
  2019-08-28  6:03 ` Tu, Lijuan
  0 siblings, 2 replies; 3+ messages in thread
From: lihong @ 2019-08-13 22:37 UTC (permalink / raw)
  To: dts; +Cc: lihong

Signed-off-by: lihong <lihongx.ma@intel.com>
---
 tests/TestSuite_pvp_diff_qemu_version.py | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/tests/TestSuite_pvp_diff_qemu_version.py b/tests/TestSuite_pvp_diff_qemu_version.py
index d238a90..d1952b5 100644
--- a/tests/TestSuite_pvp_diff_qemu_version.py
+++ b/tests/TestSuite_pvp_diff_qemu_version.py
@@ -45,6 +45,7 @@ from scapy.utils import wrpcap
 from test_case import TestCase
 from settings import HEADER_SIZE
 from virt_common import VM
+from pktgen import PacketGeneratorHelper
 
 
 class TestVhostPVPDiffQemuVersion(TestCase):
@@ -74,6 +75,13 @@ class TestVhostPVPDiffQemuVersion(TestCase):
         res = self.verify_qemu_version_config()
         self.verify(res is True, "The path of qemu version in config file not right")
 
+        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()
+
     def set_up(self):
         """
         Run before each test case.
@@ -221,14 +229,19 @@ class TestVhostPVPDiffQemuVersion(TestCase):
             payload = frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip']
             flow = '[Ether(dst="%s")/Dot1Q(vlan=%s)/IP(src="%s",dst="%s")/("X"*%d)]' % (
                 self.virtio1_mac, vlan_id1, self.src1, self.dst1, payload)
-            self.tester.scapy_append('wrpcap("pvp_diff_qemu_version.pcap", %s)' % flow)
+            self.tester.scapy_append('wrpcap("%s/pvp_diff_qemu_version.pcap", %s)' % (
+                                self.out_path, flow))
             self.tester.scapy_execute()
 
             tgenInput = []
             port = self.tester.get_local_port(self.pf)
-            tgenInput.append((port, port, "pvp_diff_qemu_version.pcap"))
-            _, pps = self.tester.traffic_generator_throughput(
-                tgenInput, delay=30)
+            tgenInput.append((port, port, "%s/pvp_diff_qemu_version.pcap" % self.out_path))
+
+            self.tester.pktgen.clear_streams()
+            streams = self.pktgen_helper.prepare_stream_from_tginput(tgenInput, 100, None, self.tester.pktgen)
+            # set traffic option
+            traffic_opt = {'delay': 5, 'duration': 20}
+            _, pps = self.tester.pktgen.measure_throughput(stream_ids=streams, options=traffic_opt)
             Mpps = pps / 1000000.0
             pct = Mpps * 100 / float(self.wirespeed(self.nic, frame_size, 1))
             self.verify(Mpps != 0, "can not received data of frame size %d" % frame_size)
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-13 22:37 [dts] [PATCH V1] tests/pvp_diff_qemu_version: update code to support trex lihong
2019-08-20  2:37 ` Wang, Yinan
2019-08-28  6:03 ` Tu, Lijuan

test suite reviews and discussions

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/dts/0 dts/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dts dts/ http://inbox.dpdk.org/dts \
		dts@dpdk.org
	public-inbox-index dts


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dts


AGPL code for this site: git clone https://public-inbox.org/ public-inbox