diff options
| author | Stefan Stanacar <stefanx.stanacar@intel.com> | 2013-11-26 11:18:22 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-03 17:45:51 +0000 |
| commit | b4d9b4208b1c06164c4eeea2110408fb404dba1c (patch) | |
| tree | 12709d6e6b26777f9a2973022a2e7b32ea0e3d2b /meta/lib/oeqa/utils/sshcontrol.py | |
| parent | fd2d16519d964ef3420cb83ac9680a4b6206cefa (diff) | |
| download | poky-b4d9b4208b1c06164c4eeea2110408fb404dba1c.tar.gz | |
testimage: use the new targetcontrol.py module for running tests
This patch makes the necessary changes for using the targetcontrol.py module
so that one can run the same tests on a qemu instance or a remote machine
based on the value of TEST_TARGET variable: "qemu" or "simpleremote".
The default value is "qemu" which starts a qemu instance and it's the
with what we currently have.
With "simpleremote", the remote machine must be up with network and ssh
and you need to set TEST_TARGET_IP with the IP address of the remote machine
(it can still be a qemu instance that was manually started).
Basically testimage.bbclass now does something along the lines of:
- load tests -> deploy (prepare) / start target -> run tests.
There were a couple of changes necessary for tests and
also some cleanups/renames that were needed to adjust this change. (use
ip everywhere when refering to target and server_ip when refering to host/build machine)
Also two unnecessary and unsed methods were dropped from sshcontrol.
[ YOCTO #5554 ]
(From OE-Core rev: a7820350fa3271d78ed7476e02f4aef593be1125)
Signed-off-by: Stefan Stanacar <stefanx.stanacar@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils/sshcontrol.py')
| -rw-r--r-- | meta/lib/oeqa/utils/sshcontrol.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/meta/lib/oeqa/utils/sshcontrol.py b/meta/lib/oeqa/utils/sshcontrol.py index 07257b8948..a0dcf023bd 100644 --- a/meta/lib/oeqa/utils/sshcontrol.py +++ b/meta/lib/oeqa/utils/sshcontrol.py | |||
| @@ -13,8 +13,8 @@ import select | |||
| 13 | 13 | ||
| 14 | class SSHControl(object): | 14 | class SSHControl(object): |
| 15 | 15 | ||
| 16 | def __init__(self, host=None, timeout=300, logfile=None): | 16 | def __init__(self, ip=None, timeout=300, logfile=None): |
| 17 | self.host = host | 17 | self.ip = ip |
| 18 | self.timeout = timeout | 18 | self.timeout = timeout |
| 19 | self._starttime = None | 19 | self._starttime = None |
| 20 | self._out = '' | 20 | self._out = '' |
| @@ -35,7 +35,7 @@ class SSHControl(object): | |||
| 35 | def _internal_run(self, cmd): | 35 | def _internal_run(self, cmd): |
| 36 | # We need this for a proper PATH | 36 | # We need this for a proper PATH |
| 37 | cmd = ". /etc/profile; " + cmd | 37 | cmd = ". /etc/profile; " + cmd |
| 38 | command = self.ssh + [self.host, cmd] | 38 | command = self.ssh + [self.ip, cmd] |
| 39 | self.log("[Running]$ %s" % " ".join(command)) | 39 | self.log("[Running]$ %s" % " ".join(command)) |
| 40 | self._starttime = time.time() | 40 | self._starttime = time.time() |
| 41 | # ssh hangs without os.setsid | 41 | # ssh hangs without os.setsid |
| @@ -48,10 +48,10 @@ class SSHControl(object): | |||
| 48 | if time is 0 will let cmd run until it finishes. | 48 | if time is 0 will let cmd run until it finishes. |
| 49 | Time can be passed to here or can be set per class instance.""" | 49 | Time can be passed to here or can be set per class instance.""" |
| 50 | 50 | ||
| 51 | if self.host: | 51 | if self.ip: |
| 52 | sshconn = self._internal_run(cmd) | 52 | sshconn = self._internal_run(cmd) |
| 53 | else: | 53 | else: |
| 54 | raise Exception("Remote IP/host hasn't been set, I can't run ssh without one.") | 54 | raise Exception("Remote IP hasn't been set, I can't run ssh without one.") |
| 55 | 55 | ||
| 56 | # run the command forever | 56 | # run the command forever |
| 57 | if timeout == 0: | 57 | if timeout == 0: |
| @@ -108,15 +108,9 @@ class SSHControl(object): | |||
| 108 | return (ret, out) | 108 | return (ret, out) |
| 109 | 109 | ||
| 110 | def copy_to(self, localpath, remotepath): | 110 | def copy_to(self, localpath, remotepath): |
| 111 | actualcmd = [localpath, 'root@%s:%s' % (self.host, remotepath)] | 111 | actualcmd = [localpath, 'root@%s:%s' % (self.ip, remotepath)] |
| 112 | return self._internal_scp(actualcmd) | 112 | return self._internal_scp(actualcmd) |
| 113 | 113 | ||
| 114 | def copy_from(self, remotepath, localpath): | 114 | def copy_from(self, remotepath, localpath): |
| 115 | actualcmd = ['root@%s:%s' % (self.host, remotepath), localpath] | 115 | actualcmd = ['root@%s:%s' % (self.ip, remotepath), localpath] |
| 116 | return self._internal_scp(actualcmd) | 116 | return self._internal_scp(actualcmd) |
| 117 | |||
| 118 | def get_status(self): | ||
| 119 | return self._ret | ||
| 120 | |||
| 121 | def get_output(self): | ||
| 122 | return self._out | ||
