mirror of
https://git.yoctoproject.org/poky
synced 2026-02-10 02:33:02 +01:00
Instead of considering that ping test passed after 1 reply, wait for at least 5 consecutive replies in 60 seconds (which should be enough time for connman to reconfigure the interface in systemd images and help with the fake ssh/tests fails.) (From OE-Core rev: 6fd19a9df0ad25b2822f12e2c3a97f1b71068d4e) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
21 lines
662 B
Python
21 lines
662 B
Python
import subprocess
|
|
import unittest
|
|
import sys
|
|
import time
|
|
from oeqa.oetest import oeRuntimeTest
|
|
|
|
class PingTest(oeRuntimeTest):
|
|
|
|
def test_ping(self):
|
|
output = ''
|
|
count = 0
|
|
endtime = time.time() + 60
|
|
while count < 5 and time.time() < endtime:
|
|
proc = subprocess.Popen("ping -c 1 %s" % oeRuntimeTest.tc.qemu.ip, shell=True, stdout=subprocess.PIPE)
|
|
output += proc.communicate()[0]
|
|
if proc.poll() == 0:
|
|
count += 1
|
|
else:
|
|
count = 0
|
|
self.assertEqual(count, 5, msg = "Expected 5 consecutive replies, got %d.\nping output is:\n%s" % (count,output))
|