summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/runtime/cases/ping.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oeqa/runtime/cases/ping.py')
-rw-r--r--meta/lib/oeqa/runtime/cases/ping.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/meta/lib/oeqa/runtime/cases/ping.py b/meta/lib/oeqa/runtime/cases/ping.py
index f72460e7f3..efb91d4cc9 100644
--- a/meta/lib/oeqa/runtime/cases/ping.py
+++ b/meta/lib/oeqa/runtime/cases/ping.py
@@ -7,7 +7,7 @@
7from subprocess import Popen, PIPE 7from subprocess import Popen, PIPE
8from time import sleep 8from time import sleep
9 9
10from oeqa.runtime.case import OERuntimeTestCase 10from oeqa.runtime.case import OERuntimeTestCase, run_network_serialdebug
11from oeqa.core.decorator.oetimeout import OETimeout 11from oeqa.core.decorator.oetimeout import OETimeout
12from oeqa.core.exception import OEQATimeoutError 12from oeqa.core.exception import OEQATimeoutError
13 13
@@ -18,6 +18,13 @@ class PingTest(OERuntimeTestCase):
18 output = '' 18 output = ''
19 count = 0 19 count = 0
20 self.assertNotEqual(len(self.target.ip), 0, msg="No target IP address set") 20 self.assertNotEqual(len(self.target.ip), 0, msg="No target IP address set")
21
22 # If the target IP is localhost (because user-space networking is being used),
23 # then there's no point in pinging it.
24 if self.target.ip.startswith("127.0.0.") or self.target.ip in ("localhost", "::1"):
25 print("runtime/ping: localhost detected, not pinging")
26 return
27
21 try: 28 try:
22 while count < 5: 29 while count < 5:
23 cmd = 'ping -c 1 %s' % self.target.ip 30 cmd = 'ping -c 1 %s' % self.target.ip
@@ -29,6 +36,7 @@ class PingTest(OERuntimeTestCase):
29 count = 0 36 count = 0
30 sleep(1) 37 sleep(1)
31 except OEQATimeoutError: 38 except OEQATimeoutError:
39 run_network_serialdebug(self.target.runner)
32 self.fail("Ping timeout error for address %s, count %s, output: %s" % (self.target.ip, count, output)) 40 self.fail("Ping timeout error for address %s, count %s, output: %s" % (self.target.ip, count, output))
33 msg = ('Expected 5 consecutive, got %d.\n' 41 msg = ('Expected 5 consecutive, got %d.\n'
34 'ping output is:\n%s' % (count,output)) 42 'ping output is:\n%s' % (count,output))