test suite reviews and discussions
 help / color / mirror / Atom feed
From: zhuwenhui <wenhuix.zhu@intel.com>
To: dts@dpdk.org
Cc: zhuwenhui <wenhuix.zhu@intel.com>
Subject: [dts] [PATCH V1] tests/vhost_1024_ethports:add new case
Date: Mon, 12 Aug 2019 16:50:42 +0800	[thread overview]
Message-ID: <1565599842-66863-1-git-send-email-wenhuix.zhu@intel.com> (raw)

Add a new suite based on test_plan.

Signed-off-by: zhuwenhui <wenhuix.zhu@intel.com>
---
 tests/TestSuite_vhost_1024_ethports.py | 102 +++++++++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 tests/TestSuite_vhost_1024_ethports.py

diff --git a/tests/TestSuite_vhost_1024_ethports.py b/tests/TestSuite_vhost_1024_ethports.py
new file mode 100644
index 0000000..0c14e8d
--- /dev/null
+++ b/tests/TestSuite_vhost_1024_ethports.py
@@ -0,0 +1,102 @@
+# BSD LICENSE
+#
+# Copyright (c) <2019>, Intel Corporation.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+#   * Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#   * Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#   * Neither the name of Intel Corporation nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+DPDK Test suite.
+Basic test for launch vhost with 1024 ethports
+"""
+
+import utils
+from test_case import TestCase
+
+
+class TestVhost1024Ethports(TestCase):
+
+    def set_up_all(self):
+        """
+        Run at the start of each test suite.
+        """
+        self.max_ethport = 1024
+        self.queue = 1
+        self.dut_ports = self.dut.get_ports()
+        self.verify(len(self.dut_ports) >= 1, 'Insufficient ports for testing')
+        self.mem_channels = self.dut.get_memory_channels()
+        cores = self.dut.get_core_list("1S/2C/1T")
+        self.coremask = utils.create_mask(cores)
+        self.build_user_dpdk()
+
+    def set_up(self):
+        """
+        Run before each test case.
+        """
+        self.dut.send_expect('rm -rf ./vhost-net*', '# ')
+        self.dut.send_expect('killall -s INT testpmd', '# ')
+        self.vhost_user = self.dut.new_session(suite='vhost-user')
+
+    def build_user_dpdk(self):
+        self.dut.send_expect(
+            "sed -i 's/CONFIG_RTE_MAX_ETHPORTS=32$/CONFIG_RTE_MAX_ETHPORTS=1024/' config/common_base", '#', 30)
+        self.dut.build_install_dpdk(self.target)
+
+    def restore_dpdk(self):
+        self.dut.send_expect(
+            "sed -i 's/CONFIG_RTE_MAX_ETHPORTS=1024$/CONFIG_RTE_MAX_ETHPORTS=32/' config/common_base", '#', 30)
+        self.dut.build_install_dpdk(self.target)
+
+    def test_launch_vhost_with_1024_ethports(self):
+        """
+        Test function of launch vhost with 1024 ethports
+        """
+        command_line_vdev = ''
+        for ethport in range(self.max_ethport):
+            command_line_vdev += '--vdev "eth_vhost%d,iface=vhost-net%d,queues=%d" ' %(ethport, ethport, self.queue)
+        command_line_argument = '/app/testpmd -c %s -n %d --socket-mem 10240,10240 '\
+                        '--file-prefix=vhost ' %(self.coremask, self.mem_channels)
+        command_line_client = self.dut.target + command_line_argument + command_line_vdev + '-- -i'
+        try:
+            out = self.vhost_user.send_expect(command_line_client, 'testpmd> ', 120)
+        except Exception as e:
+            self.verify(0, 'start testpmd failed')
+        self.vhost_user.send_expect("quit", "#", 120)
+        self.verify("Done" in out, "launch vhost with 1024 ethports failed")
+
+    def tear_down(self):
+        """
+        Run after each test case.
+        """
+        self.dut.send_expect('rm -rf ./vhost-net*', '# ')
+        self.dut.close_session(self.vhost_user)
+
+    def tear_down_all(self):
+        """
+        Run after each test suite.
+        """
+        self.restore_dpdk()
-- 
2.17.2


             reply	other threads:[~2019-08-12  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12  8:50 zhuwenhui [this message]
2019-08-13  6:40 ` Wang, Yinan
2019-08-21  9:32 ` 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=1565599842-66863-1-git-send-email-wenhuix.zhu@intel.com \
    --to=wenhuix.zhu@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).