summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Stanacar <stefanx.stanacar@intel.com>2013-08-30 19:48:53 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-30 18:08:05 +0100
commitefff0d55048d674047039668397d24797c1dba72 (patch)
treec1a7bae5bc7c0e4810c5ea0a90bd65af9e19c0f7
parent36fcb616b0c87c70fa0aa803d5fef4c5f35be5b6 (diff)
downloadpoky-efff0d55048d674047039668397d24797c1dba72.tar.gz
lib/oeqa/runtime: ping: fix ping false fail
We run the ping test as soon as we reach the login prompt. But sometimes (seen in sato systemd) we end up with link down/link up stuff like: qemux86-64 login: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready e1000: eth0 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready The logic behind ping -w 30 -c 1 was to wait at most 30 seconds for at least one reply, but there is a catch: reply doesn't seems to be echo reply but any reply (non-reply means loss not network error) ping's man page: -w deadline Specify a timeout, in seconds, before ping exits regardless of how many packets have been sent or received. In this case ping does not stop after count packet are sent, it waits either for deadline expire or until count probes are answered or for some error notification from network. Just when the link up/link down happens ping returns: From 192.168.7.1 icmp_seq=1 Destination Host Unreachable --- 192.168.7.2 ping statistics --- 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms and exits sooner than the 30 seconds timeout. This patch should do what was originally intended (wait at most 30 seconds for at least one reply). (From OE-Core rev: 56d144fd22d37189e49cdf3032afb00f0be469c6) Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/lib/oeqa/runtime/ping.py12
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 @@
1import subprocess 1import subprocess
2import unittest 2import unittest
3import sys 3import sys
4import time
4from oeqa.oetest import oeRuntimeTest 5from oeqa.oetest import oeRuntimeTest
5 6
6class PingTest(oeRuntimeTest): 7class 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)