test suite reviews and discussions
 help / color / mirror / Atom feed
From: Hongbo Li <hongbox.li@intel.com>
To: dts@dpdk.org
Cc: Hongbo Li <hongbox.li@intel.com>
Subject: [dts][PATCH V1 2/2] tests/ice_iavf_fdir: add new cases according to testplan
Date: Sat, 31 Dec 2022 01:42:27 +0800	[thread overview]
Message-ID: <20221230174227.10809-2-hongbox.li@intel.com> (raw)
In-Reply-To: <20221230174227.10809-1-hongbox.li@intel.com>

add subcase 8 to test Kill VF process and create a new rule

Signed-off-by: Hongbo Li <hongbox.li@intel.com>
---
 tests/TestSuite_ice_iavf_fdir.py | 67 +++++++++++++++++++++++++++++++-
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/tests/TestSuite_ice_iavf_fdir.py b/tests/TestSuite_ice_iavf_fdir.py
index 43cac8ea..b0186c0c 100644
--- a/tests/TestSuite_ice_iavf_fdir.py
+++ b/tests/TestSuite_ice_iavf_fdir.py
@@ -8736,7 +8736,7 @@ class TestICEIAVFFdir(TestCase):
         self.pmd_output.execute_cmd("start")
 
     def launch_testpmd(self):
-        self.pmd_output.start_testpmd(
+        out = self.pmd_output.start_testpmd(
             cores="1S/4C/1T",
             param="--rxq={} --txq={}".format(self.q_num, self.q_num),
             eal_param="-a %s -a %s"
@@ -8744,6 +8744,7 @@ class TestICEIAVFFdir(TestCase):
             socket=self.ports_socket,
         )
         self.config_testpmd()
+        return out
 
     def send_packets(self, packets, pf_id=0, count=1):
         self.pkt.update_pkt(packets)
@@ -10797,6 +10798,70 @@ class TestICEIAVFFdir(TestCase):
             stats=True,
         )
 
+    def test_stress_kill_vf_process_create_new_rule(self):
+        """
+        create a fdir rule, then kill the process, relaunch testpmd, create the same fdir rule successfully and take work.
+        """
+        rules = [
+            "flow create 0 ingress pattern eth / ipv4 src is 192.168.0.0 dst is 192.1.0.0 tos is 4 / tcp src is 22 dst is 23 / end actions queue index 5 / mark / end",
+            "flow create 1 ingress pattern eth / ipv4 src is 192.168.0.0 dst is 192.1.0.0 tos is 4 / tcp src is 22 dst is 23 / end actions queue index 5 / mark / end",
+        ]
+        pkts = [
+            'Ether(dst="00:11:22:33:44:55")/IP(src="192.168.0.0",dst="192.1.0.0", tos=4)/TCP(sport=22,dport=23)/Raw("x" * 80)',
+            'Ether(dst="00:11:22:33:44:66")/IP(src="192.168.0.0",dst="192.1.0.0", tos=4)/TCP(sport=22,dport=23)/Raw("x" * 80)',
+        ]
+
+        self.create_fdir_rule(rules, check_stats=True)
+        out0 = self.send_pkts_getouput(pkts=pkts[0])
+        rfc.check_iavf_fdir_mark(
+            out0,
+            pkt_num=1,
+            check_param={"port_id": 0, "mark_id": 0, "queue": 5},
+            stats=True,
+        )
+        out1 = self.send_pkts_getouput(pkts=pkts[1])
+        rfc.check_iavf_fdir_mark(
+            out1,
+            pkt_num=1,
+            check_param={"port_id": 1, "mark_id": 0, "queue": 5},
+            stats=True,
+        )
+        # kill the process
+        self.session_secondary = self.dut.new_session()
+        out_pid = self.session_secondary.send_expect(
+            "ps -ef |grep testpmd |grep -v grep |awk '{print $2}'", "#"
+        )
+
+        kill_comd = "kill -9 %s" % (str(out_pid))
+        self.session_secondary.send_expect(kill_comd, "#")
+        self.dut.close_session(self.session_secondary)
+        # create rule again
+        out = self.launch_testpmd()
+        self.verify(
+            "fail" not in out and "Fail" not in out and "error" not in out,
+            "failed to restart testpmd normally",
+        )
+        out_flow0 = self.dut.send_expect("flow list 0", "testpmd> ")
+        out_flow1 = self.dut.send_expect("flow list 1", "testpmd> ")
+        out_flow = out_flow0 + out_flow1
+        rule_pattern = re.compile("ID.*")
+        flow = rule_pattern.findall(out_flow)
+        self.verify(len(flow) == 0, "failed to clean rule")
+        self.create_fdir_rule(rules, check_stats=True)
+        rfc.check_iavf_fdir_mark(
+            out0,
+            pkt_num=1,
+            check_param={"port_id": 0, "mark_id": 0, "queue": 5},
+            stats=True,
+        )
+        out1 = self.send_pkts_getouput(pkts=pkts[1])
+        rfc.check_iavf_fdir_mark(
+            out1,
+            pkt_num=1,
+            check_param={"port_id": 1, "mark_id": 0, "queue": 5},
+            stats=True,
+        )
+
     def test_stress_vf_port_reset_delete_rule(self):
         """
         vf reset, the origin rule can't take effect,
-- 
2.17.1


  reply	other threads:[~2022-12-30  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-30 17:42 [dts][PATCH V1 1/2] test_plans/ice_iavf_fdir: " Hongbo Li
2022-12-30 17:42 ` Hongbo Li [this message]
2023-01-04  1:34   ` [dts][PATCH V1 2/2] tests/ice_iavf_fdir: " lijuan.tu

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=20221230174227.10809-2-hongbox.li@intel.com \
    --to=hongbox.li@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).