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 DB570A0679 for ; Thu, 4 Apr 2019 11:17:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8F7A8683E; Thu, 4 Apr 2019 11:17:11 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E4E8D5F0D for ; Thu, 4 Apr 2019 11:17:09 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Apr 2019 02:17:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,306,1549958400"; d="scan'208";a="220465089" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.240.176.135]) by orsmga001.jf.intel.com with ESMTP; 04 Apr 2019 02:17:08 -0700 From: Wenjie Li To: dts@dpdk.org Cc: Wenjie Li Date: Thu, 4 Apr 2019 17:21:21 +0800 Message-Id: <1554369681-8580-1-git-send-email-wenjiex.a.li@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [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" On some platform, it will take more time to kill the process. Add a function to detect the process status, if the process is killed within DELAY_MAX seconds, 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") + def check_process(self, delay_max=10): + process_file = "/var/run/dpdk/rte/config" + delay = 0 + while delay < delay_max: + process = self.dut.send_expect("lsof %s | wc -l" % process_file, "#") + if process != '0': + time.sleep(1) + delay = delay + 1 + else: + break + self.verify(delay < delay_max, "Failed to kill the process 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() def test_clean_up_with_signal_l2fwd(self): repeat_time = 5 @@ -175,10 +187,9 @@ class TestShortLiveApp(TestCase): # kill with different Signal if i%2 == 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() def test_clean_up_with_signal_l3fwd(self): repeat_time = 5 @@ -192,10 +203,9 @@ class TestShortLiveApp(TestCase): # kill with different Signal if i%2 == 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() def tear_down(self): """ -- 2.17.2