test suite reviews and discussions
 help / color / Atom feed
From: lihong <lihongx.ma@intel.com>
To: dts@dpdk.org
Cc: lihong <lihongx.ma@intel.com>
Subject: [dts] [PATCH V1] tests/pvp_diff_qemu_version: update code to support trex
Date: Wed, 14 Aug 2019 06:37:47 +0800
Message-ID: <1565735867-18624-1-git-send-email-lihongx.ma@intel.com> (raw)

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


             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13 22:37 lihong [this message]
2019-08-20  2:37 ` Wang, Yinan
2019-08-28  6:03 ` Tu, Lijuan

Reply instructions:

You may reply publically 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=1565735867-18624-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

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