lib/oeqa/runtime: ping: fix ping false fail
authorStefan Stanacar <stefanx.stanacar@intel.com>
Fri, 30 Aug 2013 16:48:53 +0000 (19:48 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 30 Aug 2013 17:08:05 +0000 (18:08 +0100)
commitd2eacb20c1da3e9bf24f9fc0635227b48ce5677d
tree40c6d4548ed2e549e8949e79da774782a024776f
parentbef6938cce72b2863aec6acde3d1d3940469937a
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>
meta/lib/oeqa/runtime/ping.py