diff options
Diffstat (limited to 'meta/lib/oeqa/runtime/ping.py')
-rw-r--r-- | meta/lib/oeqa/runtime/ping.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/meta/lib/oeqa/runtime/ping.py b/meta/lib/oeqa/runtime/ping.py index d6a0c28628..935f638891 100644 --- a/meta/lib/oeqa/runtime/ping.py +++ b/meta/lib/oeqa/runtime/ping.py | |||
@@ -1,11 +1,17 @@ | |||
1 | import subprocess | 1 | import subprocess |
2 | import unittest | 2 | import unittest |
3 | import sys | 3 | import sys |
4 | import time | ||
4 | from oeqa.oetest import oeRuntimeTest | 5 | from oeqa.oetest import oeRuntimeTest |
5 | 6 | ||
6 | class PingTest(oeRuntimeTest): | 7 | class PingTest(oeRuntimeTest): |
7 | 8 | ||
8 | def test_ping(self): | 9 | def test_ping(self): |
9 | status = subprocess.call("ping -w 30 -c 1 %s" % oeRuntimeTest.tc.qemu.ip, shell=True, stdout=subprocess.PIPE) | 10 | output = '' |
10 | self.assertEqual(status, 0) | 11 | status = None |
11 | 12 | endtime = time.time() + 30 | |
13 | while status != 0 and time.time() < endtime: | ||
14 | proc = subprocess.Popen("ping -c 1 %s" % oeRuntimeTest.tc.qemu.ip, shell=True, stdout=subprocess.PIPE) | ||
15 | output += proc.communicate()[0] | ||
16 | status = proc.poll() | ||
17 | self.assertEqual(status, 0, msg = "No echo reply, ping output is:\n%s" % output) | ||