summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2014-12-02 11:56:26 (GMT)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2014-12-02 12:27:06 (GMT)
commita022237da2fee5b5780de007811a6dfb08a92288 (patch)
tree9dedd213528812b6c4a62a269859c15aec3b527a
parent3eac3cff6843e5bc19e6f977e0a09c36f24c5e16 (diff)
downloadlava-dispatcher-a022237da2fee5b5780de007811a6dfb08a92288.tar.gz
lava-dispatcher-a022237da2fee5b5780de007811a6dfb08a92288.tar.xz
master: Don't test being in the master image if the serial is down
If the serial connection to a device has been dropped, prodding it to see if it's in the master image is a bit pointless. Not just pointless, it also an exception to be thrown by sendline. So instead, simply assume the device needs to be booted into master image mode again if the serial connection is gone. Change-Id: I1dd3f24afe8d017468c8e25dada2112567a4b2fe Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
-rw-r--r--lava_dispatcher/device/master.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/lava_dispatcher/device/master.py b/lava_dispatcher/device/master.py
index cc7ab58..5eddb37 100644
--- a/lava_dispatcher/device/master.py
+++ b/lava_dispatcher/device/master.py
@@ -116,6 +116,7 @@ class MasterImageTarget(Target):
if self.config.power_off_cmd:
self.context.run_command(self.config.power_off_cmd)
finalize_process(self.proc)
+ self.proc = None
def deploy_linaro(self, hwpack, rfs, dtb, rootfstype, bootloadertype):
self.boot_master_image()
@@ -496,12 +497,16 @@ class MasterImageTarget(Target):
@contextlib.contextmanager
def _as_master(self):
"""A session that can be used to run commands in the master image."""
- self.proc.sendline("")
- match_id = self.proc.expect(
- [self.MASTER_PS1_PATTERN, pexpect.TIMEOUT],
- timeout=10, lava_no_logging=1)
- if match_id == 1:
+ if self.proc is not None:
+ self.proc.sendline("")
+ match_id = self.proc.expect(
+ [self.MASTER_PS1_PATTERN, pexpect.TIMEOUT],
+ timeout=10, lava_no_logging=1)
+ if match_id == 1:
+ self.boot_master_image()
+ else:
self.boot_master_image()
+
yield MasterCommandRunner(self)
def _boot_linaro_image(self):