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 3/3] virtio: update vhost cuse and user one vm cases
Date: Thu, 21 Jan 2016 14:42:52 +0800	[thread overview]
Message-ID: <1453358572-30310-3-git-send-email-jingguox.fu@intel.com> (raw)
In-Reply-To: <1453358572-30310-1-git-send-email-jingguox.fu@intel.com>

1. fix get rx stat function
2. add stream
3. update notice info

Signed-off-by: Jingguo Fu <jingguox.fu@intel.com>
---
 tests/TestSuite_vhost_cuse_one_copy_one_vm.py | 34 +++++++++++++++++----------
 tests/TestSuite_vhost_user_one_copy_one_vm.py | 34 +++++++++++++++++----------
 2 files changed, 43 insertions(+), 25 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..22d531c 100644
--- a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
+++ b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
@@ -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..e06d8e9 100644
--- a/tests/TestSuite_vhost_user_one_copy_one_vm.py
+++ b/tests/TestSuite_vhost_user_one_copy_one_vm.py
@@ -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-21  6:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-21  6:42 [dts] [DTS][PATCH 1/3] virtio: update vhost cuse cases Jingguo Fu
2016-01-21  6:42 ` [dts] [DTS][PATCH 2/3] virtio: update vhost user cases Jingguo Fu
2016-01-21  7:58   ` Xu, Qian Q
2016-01-21  9:03     ` Fu, JingguoX
2016-01-22  1:55       ` Xu, Qian Q
2016-01-22  2:33         ` Fu, JingguoX
2016-01-22  8:46         ` Fu, JingguoX
2016-01-21  6:42 ` Jingguo Fu [this message]
2016-01-21  8:03 ` [dts] [DTS][PATCH 1/3] virtio: update vhost cuse cases Xu, Qian Q

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=1453358572-30310-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).