summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2019-11-16 19:35:16 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-11-21 23:08:19 +0000
commit7ad08760860ade0d3abf607430563f25daaa78a0 (patch)
treefdb7ff7780ee43d4b4601a6d945b9594438a868d /meta
parent18ad61198f9b5973666e835be944237e096f0958 (diff)
downloadpoky-7ad08760860ade0d3abf607430563f25daaa78a0.tar.gz
oeqa/runtime/boot: add reboot test
(From OE-Core rev: c8ddebee04a7c752986b407b98f4d0175f447d01) Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oeqa/runtime/cases/boot.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/lib/oeqa/runtime/cases/boot.py b/meta/lib/oeqa/runtime/cases/boot.py
new file mode 100644
index 0000000000..2142f400a0
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/boot.py
@@ -0,0 +1,33 @@
1#
2# SPDX-License-Identifier: MIT
3#
4
5from subprocess import Popen, PIPE
6import time
7
8from oeqa.runtime.case import OERuntimeTestCase
9from oeqa.core.decorator.depends import OETestDepends
10from oeqa.core.decorator.oetimeout import OETimeout
11from oeqa.core.decorator.data import skipIfQemu
12
13class BootTest(OERuntimeTestCase):
14
15 @OETimeout(120)
16 @skipIfQemu('qemuall', 'Test only runs on real hardware')
17 @OETestDepends(['ssh.SSHTest.test_ssh'])
18 def test_reboot(self):
19 output = ''
20 count = 0
21 (status, output) = self.target.run('reboot -h')
22 while count < 5:
23 time.sleep(5)
24 cmd = 'ping -c 1 %s' % self.target.ip
25 proc = Popen(cmd, shell=True, stdout=PIPE)
26 output += proc.communicate()[0].decode('utf-8')
27 if proc.poll() == 0:
28 count += 1
29 else:
30 count = 0
31 msg = ('Expected 5 consecutive, got %d.\n'
32 'ping output is:\n%s' % (count,output))
33 self.assertEqual(count, 5, msg = msg)