From patchwork Thu Feb 16 09:41:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, ZhiminX" X-Patchwork-Id: 124003 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 495BA41CA9; Thu, 16 Feb 2023 02:22:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19B2240A8B; Thu, 16 Feb 2023 02:22:56 +0100 (CET) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 4D8C440695 for ; Thu, 16 Feb 2023 02:22:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676510574; x=1708046574; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ZplcnaVeiJ04ifGoVQCNsJchgXTeX381qvhGYoPoCIM=; b=goEBbwbrrjYwMde+KI51vPaMs19K4hViGG6PnetcEX+GUKCq9ej3z6Cg hv8udyZYMefDR/CSbf25t8N8es8TbYRwjkZfZ3qvcbIZFkp0R3q0637Lt g/7PyfDsOhDO5AQGguI91wgWtoOQs+tosqJFEO0HVqUIBIiunhpWw3jQM Og8Uo8Av/Q2KedDeMERtxWp8WOKtCDNMWt94wFWOaByVIS9sv2wSFulP+ Yz91p0iwd8v2svLr9PxYMTbIqPz8132sNYZuhuNADsdASLu0BH7RVN2Ba 9IKPkzH9AbYXu2UXfV3jCknuo9yZMsTaJKZhiaNP7siPQThoRiEBsM35/ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="394007376" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="394007376" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 17:22:53 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="812770345" X-IronPort-AV: E=Sophos;i="5.97,301,1669104000"; d="scan'208";a="812770345" Received: from unknown (HELO localhost.localdomain) ([10.239.252.96]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2023 17:22:51 -0800 From: Zhimin Huang To: dts@dpdk.org Cc: Zhimin Huang Subject: [dts][PATCH V1] tests/dcf_lifecycle: check the process status Date: Thu, 16 Feb 2023 09:41:33 +0000 Message-Id: <20230216094133.1200085-1-zhiminx.huang@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dts-bounces@dpdk.org 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 --- 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..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