test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V2 1/2] tests/multiprocess_iavf: add new cases according to testplan
@ 2022-12-27 17:44 Song Jiale
  2022-12-27 17:44 ` [dts] [PATCH V2 2/2] test_plans/multiprocess_iavf: add 2 cases Song Jiale
  0 siblings, 1 reply; 3+ messages in thread
From: Song Jiale @ 2022-12-27 17:44 UTC (permalink / raw)
  To: dts; +Cc: Song Jiale

1. add two cases according to testplan.
2. the optimization script sorts the results that match the regular.

Signed-off-by: Song Jiale <songx.jiale@intel.com>
---

v2:
-optimization the method of check_port_status.
-sorts the results that match the regular.

 tests/TestSuite_multiprocess_iavf.py | 100 ++++++++++++++++++++++++++-
 1 file changed, 99 insertions(+), 1 deletion(-)

diff --git a/tests/TestSuite_multiprocess_iavf.py b/tests/TestSuite_multiprocess_iavf.py
index bb8e0c98..dbd660be 100644
--- a/tests/TestSuite_multiprocess_iavf.py
+++ b/tests/TestSuite_multiprocess_iavf.py
@@ -476,7 +476,7 @@ class TestMultiprocessIavf(TestCase):
         )
         pkt_num = kwargs.get("pkt_num")
         res = self.get_pkt_statistic(out, **kwargs)
-        res_num = res["rx-total"]
+        res_num = res["rx-packets"]
         self.verify(
             res_num == pkt_num,
             "fail: got wrong number of packets, expect pakcet number {}, got {}".format(
@@ -804,6 +804,19 @@ class TestMultiprocessIavf(TestCase):
             "some subcases failed, detail as below:{}".format(msg),
         )
 
+    def check_port_status(self, pmd_output, port_id, status=True):
+        port_status = pmd_output.get_port_link_status(port_id)
+        if status:
+            self.verify(
+                port_status == "up",
+                "The expected link state is up, but the actual status is down",
+            )
+        else:
+            self.verify(
+                port_status == "down",
+                "The expected link state is down, but the actual status is up",
+            )
+
     def test_multiprocess_simple_mpbasicoperation(self):
         """
         Basic operation.
@@ -1068,6 +1081,7 @@ class TestMultiprocessIavf(TestCase):
             r"Port \d+\s+-\s+rx:\s+(?P<rx>\d+)\s+tx:.*PORTS", out, re.DOTALL
         )
         rx_num = re.findall(r"Client\s+\d\s+-\s+rx:\s+(\d+)", res.group(0))
+        rx_num.sort(reverse=True)
         for i in range(proc_num):
             self.verify(
                 int(rx_num[i]) > 0,
@@ -1677,6 +1691,90 @@ class TestMultiprocessIavf(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")
+            self.check_port_status(pmd_output, port_id=0, status=True)
+        # 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], port_id=0, status=False)
+        self.check_port_status(self.pmd_output_list[1], port_id=0, 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")
+            self.check_port_status(pmd_output, port_id=0, status=True)
+        # 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], port_id=0, status=True)
+        self.check_port_status(self.pmd_output_list[1], port_id=0, status=True)
+
     def set_fields(self):
         """set ip protocol field behavior"""
         fields_config = {
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-28  3:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-27 17:44 [dts] [PATCH V2 1/2] tests/multiprocess_iavf: add new cases according to testplan Song Jiale
2022-12-27 17:44 ` [dts] [PATCH V2 2/2] test_plans/multiprocess_iavf: add 2 cases Song Jiale
2022-12-28  3:28   ` Ling, Jin

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).