[V1] tests/dcf_lifecycle: check the process status

Message ID 20230216094133.1200085-1-zhiminx.huang@intel.com (mailing list archive)
State Superseded
Headers
Series [V1] tests/dcf_lifecycle: check the process status |

Checks

Context Check Description
ci/Intel-dts-format-test fail Testing issues
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-suite-test fail Testing issues

Commit Message

Huang, ZhiminX Feb. 16, 2023, 9:41 a.m. UTC
  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>
---
 tests/TestSuite_dcf_lifecycle.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
  

Patch

diff --git a/tests/TestSuite_dcf_lifecycle.py b/tests/TestSuite_dcf_lifecycle.py
index cd7e1824..c0f44048 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)
+        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 | grep %s | grep -v grep | grep cap=dcf | awk '{print $2}'`"
-            % self.vf_dcf_testpmd.split("/")[-1]
+                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