test suite reviews and discussions
 help / color / mirror / Atom feed
From: Jingguo Fu <jingguox.fu@intel.com>
To: dts@dpdk.org
Cc: Jingguo Fu <jingguox.fu@intel.com>
Subject: [dts] [DTS][PATCH V2 3/3] virtio: update vhost cuse and user one vm cases
Date: Fri, 22 Jan 2016 16:45:56 +0800	[thread overview]
Message-ID: <1453452356-12785-3-git-send-email-jingguox.fu@intel.com> (raw)
In-Reply-To: <1453452356-12785-1-git-send-email-jingguox.fu@intel.com>

	1. fix get rx stat function
	2. add stream
	3. update notice info
	4. "RecvPackets" ==> "Injection",
        5. "SendPackets" ==> "Throughput"

        modified:       tests/TestSuite_vhost_cuse_one_copy_one_vm.py
                        tests/TestSuite_vhost_user_one_copy_one_vm.py

Signed-off-by: Jingguo Fu <jingguox.fu@intel.com>
---
 tests/TestSuite_vhost_cuse_one_copy_one_vm.py | 36 ++++++++++++++++-----------
 tests/TestSuite_vhost_user_one_copy_one_vm.py | 36 +++++++++++++++++----------
 2 files changed, 45 insertions(+), 27 deletions(-)

diff --git a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
index bff5760..007ac37 100644
--- a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
+++ b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
@@ -116,7 +116,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
         self.virtio_cmd_params = \
         'csum=off,gso=off,guest_csum=off,guest_tso4=off,guest_tso6=off,guest_ecn=off'
         # Define the table columns
-        self.header_row = ["FrameSize(B)", "RecvPackets(Mpps)", "SendPackets(Mpps)", "LineRate(%)"]
+        self.header_row = ["FrameSize(B)", "Injection(Mpps)", "Throughput(Mpps)", "LineRate(%)"]
         self.memory_channel = 4
 
     def set_up(self):
@@ -162,13 +162,15 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
         self.dut.send_expect(self.vhostapp_testcmd, "# ", 40)
         time.sleep(30)
         try:
-            print "Launch vhost sample\n"
+            print "Launch vhost sample:"
             self.dut.session.copy_file_from("/root/dpdk/vhost.out")
             fp = open('./vhost.out', 'r')
             out = fp.read()
             fp.close()
             if "Error" in out:
                 raise Exception("Launch vhost sample failed")
+            else:
+                print "Launch vhost sample finished"
         except Exception as e:
             print dts.RED("Failed to launch vhost sample: %s" % str(e))
 
@@ -252,8 +254,8 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
                     self.virtio1 = intf
                 if self.virtio2_mac in out_mac:
                     self.virtio2 = intf
-            print "\nvirtio1's intf is %s" % self.virtio1
-            print "\nvirtio2's intf is %s" % self.virtio2
+            print "Virtio1's intf is %s" % self.virtio1
+            print "Virtio2's intf is %s" % self.virtio2
             # Set the MTU for jumboframe enabled case
             if self.jumbo == 1:
                 self.vm_dut.send_expect(
@@ -309,22 +311,29 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
             recvbpsRate += int(out.strip())
             self.logger.info("Port %s: RX %f Mbps" % (port, (recvbpsRate * 1.0 / 1000000)))
 
+        self.hook_transmissoin_func()
+        self.send_expect("ixStopTransmit portList", "%", 30)
+
         return (txRate,recvRate)
 
-    def send_verify(self, case, frame_sizes, vlan_id1=0):
+    def send_verify(self, case, frame_sizes, vlan_id1=0, vlan_id2=0):
         dts.results_table_add_header(self.header_row)
         for frame_size in frame_sizes:
-            info = "Running test %s, and %d frame size.\n" % (case, frame_size)
+            info = "Running test %s, and %d frame size." % (case, frame_size)
             self.logger.info(info)
             payload = frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip']
-            flow = '[Ether(dst="%s")/Dot1Q(vlan=%s)/IP(src="%s",dst="%s")/("X"*%d)]' % (
+            flow1 = '[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("flow.pcap", %s)' % flow)
+            flow2 = '[Ether(dst="%s")/Dot1Q(vlan=%s)/IP(src="%s",dst="%s")/("X"*%d)]' % (
+                self.virtio2_mac, vlan_id2, self.src2, self.dst2, payload)
+            self.tester.scapy_append('wrpcap("flow1.pcap", %s)' % flow1)
+            self.tester.scapy_append('wrpcap("flow2.pcap", %s)' % flow2)
             self.tester.scapy_execute()
 
             tgenInput = []
             port = self.tester.get_local_port(self.pf)
-            tgenInput.append((port, port, "flow.pcap"))
+            tgenInput.append((port, port, "flow1.pcap"))
+            tgenInput.append((port, port, "flow2.pcap"))
 
             recvpkt, sendpkt = self.tester.traffic_generator_throughput(
                 tgenInput, delay=15)
@@ -353,7 +362,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
         out = fp.read()
         fp.close()
         # Get the VLAN ID for virtio
-        print "Check the vlan info: \n"
+        print "Check the vlan info: "
         l1 = re.findall(
             'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' %
             (str(self.virtio1_mac)), out)
@@ -367,7 +376,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
             vlan_id2 = l2[0]
             print "vlan_id2 is ", vlan_id2
 
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1)
+        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, vlan_id2)
         # Stop the Vhost sample
         self.dut.send_expect("killall -s INT vhost-switch", "#", 20)
 
@@ -386,7 +395,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
         out = fp.read()
         fp.close()
         # Get the VLAN ID for virtio
-        print "\ncheck the vlan info: \n"
+        print "Check the vlan info: "
         l1 = re.findall(
             'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' %
             (str(self.virtio1_mac)), out)
@@ -400,8 +409,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
             vlan_id2 = l2[0]
             print vlan_id2
 
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1)
-
+        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, vlan_id2)
         # Stop testpmd
         self.vm_dut.send_expect("stop", "testpmd>")
         time.sleep(1)
diff --git a/tests/TestSuite_vhost_user_one_copy_one_vm.py b/tests/TestSuite_vhost_user_one_copy_one_vm.py
index 971d9c2..7352a35 100644
--- a/tests/TestSuite_vhost_user_one_copy_one_vm.py
+++ b/tests/TestSuite_vhost_user_one_copy_one_vm.py
@@ -108,7 +108,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
         self.dst2 = "192.168.4.1"
         self.vm_dut = None
 
-        self.header_row = ["FrameSize(B)", "RecvPackets(Mpps)", "SendPackets(Mpps)", "LineRate(%)"]
+        self.header_row = ["FrameSize(B)", "Injection(Mpps)", "Throughput(Mpps)", "LineRate(%)"]
         self.memory_channel = 4
 
     def set_up(self):
@@ -145,13 +145,15 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
         self.dut.send_expect(self.vhostapp_testcmd, "# ", 40)
         time.sleep(30)
         try:
-            print "Launch vhost sample\n"
+            print "Launch vhost sample:"
             self.dut.session.copy_file_from("/root/dpdk/vhost.out")
             fp = open('./vhost.out', 'r')
             out = fp.read()
             fp.close()
             if "Error" in out:
                 raise Exception("Launch vhost sample failed")
+            else:
+                print "Launch vhost sample finished"
         except Exception as e:
             print dts.RED("Failed to launch vhost sample: %s" % str(e))
 
@@ -234,8 +236,8 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
                     self.virtio1 = intf
                 if self.virtio2_mac in out_mac:
                     self.virtio2 = intf
-            print "\nvirtio1's intf is %s" % self.virtio1
-            print "\nvirtio2's intf is %s" % self.virtio2
+            print "Virtio1's intf is %s" % self.virtio1
+            print "Virtio2's intf is %s" % self.virtio2
             # Set the mtu 9000 if jumboframe is enabled.
             if self.jumbo == 1:
                 self.vm_dut.send_expect(
@@ -291,22 +293,29 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
             recvbpsRate += int(out.strip())
             self.logger.info("Port %s: RX %f Mbps" % (port, (recvbpsRate * 1.0 / 1000000)))
 
+        self.hook_transmissoin_func()
+        self.send_expect("ixStopTransmit portList", "%", 30)
+
         return (txRate,recvRate)
 
-    def send_verify(self, case, frame_sizes, vlan_id1=0):
+    def send_verify(self, case, frame_sizes, vlan_id1=0, vlan_id2=0):
         dts.results_table_add_header(self.header_row)
         for frame_size in frame_sizes:
-            info = "Running test %s, and %d frame size.\n" % (case, frame_size)
+            info = "Running test %s, and %d frame size." % (case, frame_size)
             self.logger.info(info)
             payload = frame_size - HEADER_SIZE['eth'] - HEADER_SIZE['ip']
-            flow = '[Ether(dst="%s")/Dot1Q(vlan=%s)/IP(src="%s",dst="%s")/("X"*%d)]' % (
+            flow1 = '[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("flow.pcap", %s)' % flow)
+            flow2 = '[Ether(dst="%s")/Dot1Q(vlan=%s)/IP(src="%s",dst="%s")/("X"*%d)]' % (
+                self.virtio2_mac, vlan_id2, self.src2, self.dst2, payload)
+            self.tester.scapy_append('wrpcap("flow1.pcap", %s)' % flow1)
+            self.tester.scapy_append('wrpcap("flow2.pcap", %s)' % flow2)
             self.tester.scapy_execute()
 
             tgenInput = []
             port = self.tester.get_local_port(self.pf)
-            tgenInput.append((port, port, "flow.pcap"))
+            tgenInput.append((port, port, "flow1.pcap"))
+            tgenInput.append((port, port, "flow2.pcap"))
 
             recvpkt, sendpkt = self.tester.traffic_generator_throughput(
                 tgenInput, delay=15)
@@ -335,7 +344,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
         out = fp.read()
         fp.close()
         # Get the VLAN ID for virtio
-        print "Check the vlan info: \n"
+        print "Check the vlan info: "
         l1 = re.findall(
             'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' %
             (str(self.virtio1_mac)), out)
@@ -349,7 +358,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
             vlan_id2 = l2[0]
             print "vlan_id2 is ", vlan_id2
 
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1)
+        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, vlan_id2)
         # Stop the Vhost sample
         self.dut.send_expect("killall -s INT vhost-switch", "#", 20)
 
@@ -368,7 +377,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
         out = fp.read()
         fp.close()
         # Get the VLAN ID for virtio
-        print "Check the vlan info: \n"
+        print "Check the vlan info: "
         l1 = re.findall(
             'MAC_ADDRESS.*?%s.*?and.*?VLAN_TAG.*?(\d+).*?registered' %
             (str(self.virtio1_mac)), out)
@@ -381,7 +390,8 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
         if len(l2) > 0:
             vlan_id2 = l2[0]
             print vlan_id2
-        self.send_verify(self.running_case, self.frame_sizes, vlan_id1)
+
+        self.send_verify(self.running_case, self.frame_sizes, vlan_id1, vlan_id2)
         # Stop testpmd
         self.vm_dut.send_expect("stop", "testpmd>")
         time.sleep(1)
-- 
2.1.0

  parent reply	other threads:[~2016-01-22  8:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22  8:45 [dts] [DTS][PATCH V2 1/3] virtio: update vhost cuse cases Jingguo Fu
2016-01-22  8:45 ` [dts] [DTS][PATCH V2 2/3] virtio: update vhost user cases Jingguo Fu
2016-01-26  1:37   ` Xu, Qian Q
2016-01-26  1:48     ` Fu, JingguoX
2016-01-26  1:49       ` Liu, Yong
2016-01-22  8:45 ` Jingguo Fu [this message]
2016-01-22  9:18 ` [dts] [DTS][PATCH V2 1/3] virtio: update vhost cuse cases Liu, Yong

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=1453452356-12785-3-git-send-email-jingguox.fu@intel.com \
    --to=jingguox.fu@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).