From b39c61f2d442c79d03b73e8ffd104996fcb2177e Mon Sep 17 00:00:00 2001 From: Mariano Lopez Date: Tue, 1 Nov 2016 07:48:16 +0000 Subject: oeqa/runtime/cases: Migrate runtime tests. This migrates current runtime test suite to be used with the new framework. [YOCTO #10234] Signed-off-by: Mariano Lopez --- meta/lib/oeqa/runtime/cases/ping.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 meta/lib/oeqa/runtime/cases/ping.py (limited to 'meta/lib/oeqa/runtime/cases/ping.py') diff --git a/meta/lib/oeqa/runtime/cases/ping.py b/meta/lib/oeqa/runtime/cases/ping.py new file mode 100644 index 0000000000..02f580abee --- /dev/null +++ b/meta/lib/oeqa/runtime/cases/ping.py @@ -0,0 +1,24 @@ +from subprocess import Popen, PIPE + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.oeid import OETestID +from oeqa.core.decorator.oetimeout import OETimeout + +class PingTest(OERuntimeTestCase): + + @OETimeout(30) + @OETestID(964) + 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) -- cgit 1.2.3-korg