Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Armin Kuster <akuster808@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 3/7] oeqa/runtime/boot: add reboot test
Date: Sat, 16 Nov 2019 19:35:16 -0800	[thread overview]
Message-ID: <1573961720-4099-3-git-send-email-akuster808@gmail.com> (raw)
In-Reply-To: <1573961720-4099-1-git-send-email-akuster808@gmail.com>

Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
 meta/lib/oeqa/runtime/cases/boot.py | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 meta/lib/oeqa/runtime/cases/boot.py

diff --git a/meta/lib/oeqa/runtime/cases/boot.py b/meta/lib/oeqa/runtime/cases/boot.py
new file mode 100644
index 0000000..2142f40
--- /dev/null
+++ b/meta/lib/oeqa/runtime/cases/boot.py
@@ -0,0 +1,33 @@
+#
+# SPDX-License-Identifier: MIT
+#
+
+from subprocess import Popen, PIPE
+import time
+
+from oeqa.runtime.case import OERuntimeTestCase
+from oeqa.core.decorator.depends import OETestDepends
+from oeqa.core.decorator.oetimeout import OETimeout
+from oeqa.core.decorator.data import skipIfQemu
+
+class BootTest(OERuntimeTestCase):
+
+    @OETimeout(120)
+    @skipIfQemu('qemuall', 'Test only runs on real hardware')
+    @OETestDepends(['ssh.SSHTest.test_ssh'])
+    def test_reboot(self):
+        output = ''
+        count = 0
+        (status, output) = self.target.run('reboot -h')
+        while count < 5:
+            time.sleep(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)
-- 
2.7.4



  parent reply	other threads:[~2019-11-17  3:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-17  3:35 [PATCH 1/7] /oeqa/manual/compliance-test: remove obsolete test Armin Kuster
2019-11-17  3:35 ` [PATCH 2/7] oeqa/manual/bsp-hw: remove rpm -ivh test Armin Kuster
2019-11-17  3:35 ` Armin Kuster [this message]
2019-11-17  3:35 ` [PATCH 4/7] oeqa/manual/bsp-hw: remove reboot test Armin Kuster
2019-11-17  3:35 ` [PATCH 5/7] oeqa/manual/bsp-hw: move storage tests to runtime Armin Kuster
2019-11-17  3:35 ` [PATCH 6/7] oeqa/manual/bsp-hw: remove usb and SDmicro tests Armin Kuster
2019-11-17  3:35 ` [PATCH 7/7] manual/bsd-hw: remove bash tests Armin Kuster
2019-11-17  4:02 ` ✗ patchtest: failure for "/oeqa/manual/compliance-test: ..." and 6 more Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1573961720-4099-3-git-send-email-akuster808@gmail.com \
    --to=akuster808@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox