poky/meta/lib/oeqa/runtime/cases/ping.py
Richard Purdie c7592b0147 oeqa: Drop OETestID
These IDs refer to testopia which we're no longer using. We would now use the test
names to definitively reference tests and the IDs can be dropped, along with their
supporting code.

(From OE-Core rev: 8e2d0575e4e7036b5f60e632f377a8ab2b96ead8)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2019-05-09 16:31:55 +01:00

23 lines
701 B
Python

from subprocess import Popen, PIPE
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.core.decorator.oetimeout import OETimeout
class PingTest(OERuntimeTestCase):
@OETimeout(30)
def test_ping(self):
output = ''
count = 0
while count < 5:
cmd = 'ping -c 1 %s' % self.target.ip
proc = Popen(cmd, shell=True, stdout=PIPE)
output += proc.communicate()[0].decode('utf-8')
if proc.poll() == 0:
count += 1
else:
count = 0
msg = ('Expected 5 consecutive, got %d.\n'
'ping output is:\n%s' % (count,output))
self.assertEqual(count, 5, msg = msg)