summaryrefslogtreecommitdiff
path: root/meta/lib/oeqa
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2014-04-30 13:32:00 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-04-30 21:52:12 +0100
commitc2257fa50071e4704a8152b5f1d16f899b4bed98 (patch)
tree148d07de8719c6a903d49f3c37f222bb2dafe339 /meta/lib/oeqa
parent5131094ad8f53b2052a97efd505e7a170d0c915d (diff)
downloadopenembedded-core-c2257fa50071e4704a8152b5f1d16f899b4bed98.tar.gz
openembedded-core-c2257fa50071e4704a8152b5f1d16f899b4bed98.tar.bz2
openembedded-core-c2257fa50071e4704a8152b5f1d16f899b4bed98.zip
oeqa/controllers/masterimage: more robust master image startup
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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa')
-rw-r--r--meta/lib/oeqa/controllers/masterimage.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/meta/lib/oeqa/controllers/masterimage.py b/meta/lib/oeqa/controllers/masterimage.py
index c6fc7d60e0..d151e24bd7 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")