test suite reviews and discussions
 help / color / mirror / Atom feed
From: Song Jiale <songx.jiale@intel.com>
To: dts@dpdk.org
Cc: Song Jiale <songx.jiale@intel.com>
Subject: [dts] [PATCH V1 1/2] tests/multiprocess: add new cases according to testplan
Date: Tue, 27 Dec 2022 15:20:50 +0000	[thread overview]
Message-ID: <20221227152051.504672-1-songx.jiale@intel.com> (raw)

add two cases according to testplan.

Signed-off-by: Song Jiale <songx.jiale@intel.com>
---
 tests/TestSuite_multiprocess.py | 98 ++++++++++++++++++++++++++++++++-
 1 file changed, 97 insertions(+), 1 deletion(-)

diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py
index 4fdc8c27..1a574a23 100644
--- a/tests/TestSuite_multiprocess.py
+++ b/tests/TestSuite_multiprocess.py
@@ -757,6 +757,21 @@ class TestMultiprocess(TestCase):
             "some subcases failed, detail as below:{}".format(msg),
         )
 
+    def check_port_status(self, pmd_output, status=True):
+        out = pmd_output.execute_cmd("show port info 0")
+        pattern = r"Link status:\s+(\w+)"
+        res = re.search(pattern, out).group(1)
+        if status:
+            self.verify(
+                res == "up",
+                "The expected link state is up, but the actual status is down",
+            )
+        else:
+            self.verify(
+                res == "down",
+                "The expected link state is down, but the actual status is up",
+            )
+
     def test_multiprocess_simple_mpbasicoperation(self):
         """
         Basic operation.
@@ -1691,6 +1706,88 @@ class TestMultiprocess(TestCase):
         }
         self.rte_flow(mac_ipv4_symmetric, self.multiprocess_rss_data, **pmd_param)
 
+    def test_multiprocess_port_stop(self):
+        packets = [
+            'Ether(dst="00:11:22:33:44:55", src="52:00:00:00:00:00")/IP()/Raw(load="P"*20)',
+        ]
+        # start testpmd multi-process
+        self.launch_multi_testpmd(
+            proc_type="auto",
+            queue_num=8,
+            process_num=2,
+        )
+        for pmd_output in self.pmd_output_list:
+            pmd_output.execute_cmd("stop")
+        # set primary process port stop
+        self.pmd_output_list[0].execute_cmd("port stop 0")
+        self.pmd_output_list[1].execute_cmd("start")
+        fdir_pro = fdirprocess(
+            self,
+            self.pmd_output_list[1],
+            self.tester_ifaces,
+            rxq=8,
+        )
+        out = self.send_pkt_get_output(fdir_pro, packets, port_id=0, count=1)
+        # Check that no packet was received
+        self.check_pkt_num(out, port_id=0, pkt_num=0)
+        for pmd_output in self.pmd_output_list:
+            pmd_output.quit()
+
+        # start testpmd multi-process
+        self.launch_multi_testpmd(
+            proc_type="auto",
+            queue_num=8,
+            process_num=2,
+        )
+        for pmd_output in self.pmd_output_list:
+            pmd_output.execute_cmd("stop")
+        # set secondary process port stop
+        self.pmd_output_list[1].execute_cmd("port stop 0")
+        self.pmd_output_list[0].execute_cmd("start")
+        fdir_pro = fdirprocess(
+            self,
+            self.pmd_output_list[0],
+            self.tester_ifaces,
+            rxq=8,
+        )
+        out = self.send_pkt_get_output(fdir_pro, packets, port_id=0, count=1)
+        # Check that one packet was received in primary process
+        self.check_pkt_num(out, port_id=0, pkt_num=len(packets))
+
+    def test_multiprocess_port_reset(self):
+        # start testpmd multi-process
+        self.launch_multi_testpmd(
+            proc_type="auto",
+            queue_num=8,
+            process_num=2,
+        )
+        for pmd_output in self.pmd_output_list:
+            pmd_output.execute_cmd("stop")
+        # set primary process port reset
+        self.pmd_output_list[0].execute_cmd("port stop 0")
+        self.pmd_output_list[0].execute_cmd("port reset 0")
+        # Check that link status of port 0 is 'down' in secondary process and primary process
+        self.check_port_status(self.pmd_output_list[0], status=False)
+        self.check_port_status(self.pmd_output_list[1], status=False)
+
+        for pmd_output in self.pmd_output_list:
+            pmd_output.quit()
+
+        # start testpmd multi-process
+        self.launch_multi_testpmd(
+            proc_type="auto",
+            queue_num=8,
+            process_num=2,
+        )
+        for pmd_output in self.pmd_output_list:
+            pmd_output.execute_cmd("stop")
+        # set secondary process port reset
+        self.pmd_output_list[1].execute_cmd("port stop 0")
+        self.pmd_output_list[1].execute_cmd("port reset 0")
+        # Check that link status of port 0 is 'up' in secondary process and primary process
+        self.check_port_status(self.pmd_output_list[0], status=True)
+        self.check_port_status(self.pmd_output_list[1], status=True)
+
     def test_perf_multiprocess_performance(self):
         """
         Benchmark Multiprocess performance.
@@ -1926,4 +2023,3 @@ class TestMultiprocess(TestCase):
         Run after each test suite.
         """
         self.dut.kill_all()
-        pass
-- 
2.25.1


             reply	other threads:[~2022-12-27  7:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-27 15:20 Song Jiale [this message]
2022-12-27 15:20 ` [dts] [PATCH V1 2/2] test_plans/multiprocess: add 2 cases Song Jiale

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=20221227152051.504672-1-songx.jiale@intel.com \
    --to=songx.jiale@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).