From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9C714A0679 for ; Thu, 4 Apr 2019 11:58:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 921151B123; Thu, 4 Apr 2019 11:58:12 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id BD9F71B0F7 for ; Thu, 4 Apr 2019 11:58:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2019 02:58:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,308,1549958400"; d="scan'208";a="139916732" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga003.jf.intel.com with ESMTP; 04 Apr 2019 02:58:09 -0700 Received: from fmsmsx120.amr.corp.intel.com (10.18.124.208) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 4 Apr 2019 02:58:09 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by fmsmsx120.amr.corp.intel.com (10.18.124.208) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 4 Apr 2019 02:58:09 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.206]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.153]) with mapi id 14.03.0415.000; Thu, 4 Apr 2019 17:58:07 +0800 From: "Zhu, WenhuiX" To: "Li, WenjieX A" , "dts@dpdk.org" CC: "Li, WenjieX A" Thread-Topic: [dts] [PATCH V1] tests/short_live: use a function to detect process Thread-Index: AQHU6sdIzYBlx1xfHEWsI31Btaq7oaYrxBkQ Date: Thu, 4 Apr 2019 09:58:06 +0000 Message-ID: References: <1554369681-8580-1-git-send-email-wenjiex.a.li@intel.com> In-Reply-To: <1554369681-8580-1-git-send-email-wenjiex.a.li@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dts] [PATCH V1] tests/short_live: use a function to detect process X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "dts" Tested-by: Zhu, WenhuiX -----Original Message----- From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Wenjie Li Sent: Thursday, April 4, 2019 5:21 PM To: dts@dpdk.org Cc: Li, WenjieX A Subject: [dts] [PATCH V1] tests/short_live: use a function to detect proces= s On some platform, it will take more time to kill the process. Add a functio= n to detect the process status, if the process is killed within DELAY_MAX s= econds, break the loop and continue testing, else return "failure". Signed-off-by: Wenjie Li --- tests/TestSuite_short_live.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.py = index 7da7dd1..c18dac4 100644 --- a/tests/TestSuite_short_live.py +++ b/tests/TestSuite_short_live.py @@ -119,6 +119,18 @@ class TestShortLiveApp(TestCase): else: self.verify('PPP' not in out, "Receive test failed") =20 + def check_process(self, delay_max=3D10): + process_file =3D "/var/run/dpdk/rte/config" + delay =3D 0 + while delay < delay_max: + process =3D self.dut.send_expect("lsof %s | wc -l" % process_f= ile, "#") + if process !=3D '0': + time.sleep(1) + delay =3D delay + 1 + else: + break + self.verify(delay < delay_max, "Failed to kill the process=20 + within %s seconds" % delay_max) + def test_basic_forwarding(self): """ Basic rx/tx forwarding test @@ -161,7 +173,7 @@ class TestShortLiveApp(TestCase): self.dut.send_expect("pkill -2 testpmd", "#", 60, True) else: self.dut.send_expect("pkill -15 testpmd", "#", 60, True) - time.sleep(2) + self.check_process() =20 def test_clean_up_with_signal_l2fwd(self): repeat_time =3D 5 @@ -175,10 +187,9 @@ class TestShortLiveApp(TestCase): # kill with different Signal if i%2 =3D=3D 0: self.dut.send_expect("pkill -2 l2fwd", "#", 60, True) - time.sleep(2) else: self.dut.send_expect("pkill -15 l2fwd", "#", 60, True) - time.sleep(2) + self.check_process() =20 def test_clean_up_with_signal_l3fwd(self): repeat_time =3D 5 @@ -192,10 +203,9 @@ class TestShortLiveApp(TestCase): # kill with different Signal if i%2 =3D=3D 0: self.dut.send_expect("pkill -2 l3fwd", "#", 60, True) - time.sleep(2) else: self.dut.send_expect("pkill -15 l3fwd", "#", 60, True) - time.sleep(2) + self.check_process() =20 def tear_down(self): """ -- 2.17.2