[oe-commits] Stefan Stanacar : lib/oeqa/runtime: ping: wait for 5 echo replies

git at git.openembedded.org git at git.openembedded.org
Wed Sep 25 16:37:07 UTC 2013


Module: openembedded-core.git
Branch: master-next
Commit: a9f9969e3053b8fb3bafe43f68561cb30595220d
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=a9f9969e3053b8fb3bafe43f68561cb30595220d

Author: Stefan Stanacar <stefanx.stanacar at intel.com>
Date:   Wed Sep 25 12:30:49 2013 +0000

lib/oeqa/runtime: ping: wait for 5 echo replies

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.)

Signed-off-by: Stefan Stanacar <stefanx.stanacar at intel.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/lib/oeqa/runtime/ping.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/meta/lib/oeqa/runtime/ping.py b/meta/lib/oeqa/runtime/ping.py
index e163b96..0d028f9 100644
--- a/meta/lib/oeqa/runtime/ping.py
+++ b/meta/lib/oeqa/runtime/ping.py
@@ -8,10 +8,13 @@ class PingTest(oeRuntimeTest):
 
     def test_ping(self):
         output = ''
-        status = None
+        count = 0
         endtime = time.time() + 60
-        while status != 0 and time.time() < endtime:
+        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]
-            status = proc.poll()
-        self.assertEqual(status, 0, msg = "No echo reply, ping output is:\n%s" % output)
+            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))



More information about the Openembedded-commits mailing list