oeqa/targetcontrol: make ssh control optional

Added new parameter 'ssh' to targetcontrol 'start' method
to be able to test images without running ssh server.

[YOCTO #8498]

(From OE-Core rev: 1c3c66aadd43092bc19242b0651ee810cc31fe7c)

(From OE-Core rev: 67ccf7413b2ac9f516dbdaa6a39d4cec38a6c94d)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh 2016-02-13 11:02:13 +02:00 committed by Richard Purdie
parent 0ade65834b
commit 7066f1671e
2 changed files with 12 additions and 10 deletions

View File

@ -68,7 +68,7 @@ class BaseTarget(object):
bb.note("SSH log file: %s" % self.sshlog)
@abstractmethod
def start(self, params=None):
def start(self, params=None, ssh=True):
pass
@abstractmethod
@ -176,11 +176,12 @@ class QemuTarget(BaseTarget):
bb.note("Qemu log file: %s" % self.qemulog)
super(QemuTarget, self).deploy()
def start(self, params=None):
if self.runner.start(params):
self.ip = self.runner.ip
self.server_ip = self.runner.server_ip
self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
def start(self, params=None, ssh=True):
if self.runner.start(params, get_ip=ssh):
if ssh:
self.ip = self.runner.ip
self.server_ip = self.runner.server_ip
self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
else:
self.stop()
if os.path.exists(self.qemulog):
@ -231,8 +232,9 @@ class SimpleRemoteTarget(BaseTarget):
def deploy(self):
super(SimpleRemoteTarget, self).deploy()
def start(self, params=None):
self.connection = SSHControl(self.ip, logfile=self.sshlog, port=self.port)
def start(self, params=None, ssh=True):
if ssh:
self.connection = SSHControl(self.ip, logfile=self.sshlog, port=self.port)
def stop(self):
self.connection = None

View File

@ -178,7 +178,7 @@ def create_temp_layer(templayerdir, templayername, priority=999, recipepathspec=
@contextlib.contextmanager
def runqemu(pn):
def runqemu(pn, ssh=True):
import bb.tinfoil
import bb.build
@ -222,7 +222,7 @@ def runqemu(pn):
try:
qemu.deploy()
try:
qemu.start()
qemu.start(ssh=ssh)
except bb.build.FuncFailed:
raise Exception('Failed to start QEMU - see the logs in %s' % logdir)