test suite reviews and discussions
 help / color / mirror / Atom feed
From: Zhimin Huang <zhiminx.huang@intel.com>
To: dts@dpdk.org
Cc: Zhimin Huang <zhiminx.huang@intel.com>
Subject: [dts][PATCH V2] tests/dcf_lifecycle: check the process status
Date: Thu, 16 Feb 2023 10:21:32 +0000	[thread overview]
Message-ID: <20230216102132.1200497-1-zhiminx.huang@intel.com> (raw)

when the process is not completely killed, the flow rule in dcf will
take effect and cause the test to fail.
so check the process status after kill DCF process.

Signed-off-by: Zhimin Huang <zhiminx.huang@intel.com>
---
v2:
-format the script

 tests/TestSuite_dcf_lifecycle.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/tests/TestSuite_dcf_lifecycle.py b/tests/TestSuite_dcf_lifecycle.py
index cd7e1824..d3758c6c 100644
--- a/tests/TestSuite_dcf_lifecycle.py
+++ b/tests/TestSuite_dcf_lifecycle.py
@@ -1295,13 +1295,22 @@ class TestDcfLifeCycle(TestCase):
         # Kill DCF process
         cmd = "ps aux | grep testpmd"
         self.d_a_con(cmd)
-        cmd = (
-            r"kill -9 `ps -ef | grep %s | grep -v grep | grep cap=dcf | awk '{print $2}'`"
+        grep_key = (
+            "grep %s | grep -v grep | grep cap=dcf | awk '{print $2}'"
             % self.vf_dcf_testpmd.split("/")[-1]
         )
+        cmd = r"kill -9 `ps -ef | %s`" % grep_key
         self.d_a_con(cmd)
+        out = self.check_process_status(grep_key)
+        if out:
+            self.logger.warning("the process failed to kill")
         time.sleep(1)
 
+    def check_process_status(self, process_key):
+        cmd = "ps -aux | grep -v grep | {}".format(process_key)
+        out = self.d_a_con(cmd)
+        return out
+
     def create_acl_rule_by_kernel_cmd(self, port_id=0, stats=True):
         # create an ACL rule on PF0 by kernel command
         intf = self.dut.ports_info[port_id]["port"].intf_name
-- 
2.25.1


             reply	other threads:[~2023-02-16  2:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 10:21 Zhimin Huang [this message]
2023-03-03  5:38 ` 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=20230216102132.1200497-1-zhiminx.huang@intel.com \
    --to=zhiminx.huang@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).