[dts] [PATCH V1] tests/short_live: use a function to detect process
Wenjie Li
wenjiex.a.li at intel.com
Thu Apr 4 11:21:21 CEST 2019
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 at 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
More information about the dts
mailing list