From: Wenjie Li <wenjiex.a.li@intel.com>
To: dts@dpdk.org
Cc: Wenjie Li <wenjiex.a.li@intel.com>
Subject: [dts] [PATCH V1] tests/short_live: use a function to detect process
Date: Thu, 4 Apr 2019 17:21:21 +0800 [thread overview]
Message-ID: <1554369681-8580-1-git-send-email-wenjiex.a.li@intel.com> (raw)
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 <wenjiex.a.li@intel.com>
---
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
next reply other threads:[~2019-04-04 9:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-04 9:21 Wenjie Li [this message]
2019-04-04 9:58 ` Zhu, WenhuiX
2019-04-09 1:41 ` Tu, Lijuan
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=1554369681-8580-1-git-send-email-wenjiex.a.li@intel.com \
--to=wenjiex.a.li@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).