public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 4/8] oeqa/controllers/masterimage: more robust master image startup
Date: Wed, 30 Apr 2014 13:32:00 +0100	[thread overview]
Message-ID: <14a5c1e962c2fbe217ad29c0211b2ae7d1328853.1398861075.git.paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <cover.1398861075.git.paul.eggleton@linux.intel.com>
In-Reply-To: <cover.1398861075.git.paul.eggleton@linux.intel.com>

Instead of powering up the target when the object is constructed, wait
until deploy is called. Then there are basically two different
scenarios:

a) The device is booted into the master image already, in which case
   we can just use it
b) The device is booted into another image or can't be contacted, in
   which case we need to power cycle it. Here we also now wait until it
   has booted up instead of trying to contact it immediately.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/lib/oeqa/controllers/masterimage.py | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/meta/lib/oeqa/controllers/masterimage.py b/meta/lib/oeqa/controllers/masterimage.py
index c6fc7d6..d151e24 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -87,7 +87,6 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget):
         if self.powercontrol_cmd:
             if self.powercontrol_args:
                 self.powercontrol_cmd = "%s %s" % (self.powercontrol_cmd, self.powercontrol_args)
-            self.power_ctl("on")
         if self.serialcontrol_cmd:
             if self.serialcontrol_args:
                 self.serialcontrol_cmd = "%s %s" % (self.serialcontrol_cmd, self.serialcontrol_args)
@@ -108,13 +107,25 @@ class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget):
             if status != 0:
                 bb.error("Failed rebooting target and no power control command defined. You need to manually reset the device.\n%s" % output)
 
+    def _wait_until_booted(self):
+        ''' Waits until the target device has booted (if we have just power cycled it) '''
+        # Subclasses with better methods of determining boot can override this
+        time.sleep(120)
+
     def deploy(self):
-        bb.plain("%s - deploying image on target" % self.pn)
         # base class just sets the ssh log file for us
         super(MasterImageHardwareTarget, self).deploy()
         self.master = sshcontrol.SSHControl(ip=self.ip, logfile=self.sshlog, timeout=600, port=self.port)
         status, output = self.master.run("cat /etc/masterimage")
         if status != 0:
+            # We're not booted into the master image, so try rebooting
+            bb.plain("%s - booting into the master image" % self.pn)
+            self.power_ctl("cycle")
+            self._wait_until_booted()
+
+        bb.plain("%s - deploying image on target" % self.pn)
+        status, output = self.master.run("cat /etc/masterimage")
+        if status != 0:
             bb.fatal("No ssh connectivity or target isn't running a master image.\n%s" % output)
         if self.user_cmds:
             self.deploy_cmds = self.user_cmds.split("\n")
-- 
1.9.0



  parent reply	other threads:[~2014-04-30 12:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 12:31 [PATCH 0/8] Automated hardware testing improvements Paul Eggleton
2014-04-30 12:31 ` [PATCH 1/8] oeqa/controllers/masterimage: add a base class for hw targets Paul Eggleton
2014-04-30 12:31 ` [PATCH 2/8] oeqa/targetcontrol: restart method shouldn't be abstract Paul Eggleton
2014-04-30 12:31 ` [PATCH 3/8] oeqa/controllers/masterimage: add a serial control command Paul Eggleton
2014-04-30 12:32 ` Paul Eggleton [this message]
2014-04-30 12:32 ` [PATCH 5/8] classes/testimage: if start fails, don't try to stop Paul Eggleton
2014-04-30 12:32 ` [PATCH 6/8] scripts/contrib/serdevtry: add script to handle transient serial terminals Paul Eggleton
2014-04-30 12:32 ` [PATCH 7/8] scripts/contrib/dialog-power-control: add a trivial power prompt script Paul Eggleton
2014-04-30 12:32 ` [PATCH 8/8] oeqa: add proper handling for command errors where needed Paul Eggleton

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=14a5c1e962c2fbe217ad29c0211b2ae7d1328853.1398861075.git.paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.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