diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2017-02-21 10:11:00 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-23 12:49:48 -0800 |
commit | cf0b92f8937436ced297f65a30daa911e5a1e333 (patch) | |
tree | 4608157e420f7157b51f8f4fb6e721499a38576e | |
parent | 5ff7db946cea7d0c3a227bae997f22394bd2e629 (diff) | |
download | poky-cf0b92f8937436ced297f65a30daa911e5a1e333.tar.gz |
oeqa/runtime/context.py: Fix use of getTarget() with testexport
The idea on getTarget is to use kwargs to send custom variables
to different targets, instead of this, a new variable was added
(just used for custom targets) and this broke testexport. So
in order to fix it, just add the custom variable to kwargs.
This fixes the use of getTarget() in testexport class that was
introduced in 1dc8010afd71fe46fb28bb86fb7c07a5fbd3d7cf.
(From OE-Core rev: cf138029a1f18f991fc7a28c81d85884942e9d56)
Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/testimage.bbclass | 6 | ||||
-rw-r--r-- | meta/lib/oeqa/core/target/qemu.py | 2 | ||||
-rw-r--r-- | meta/lib/oeqa/runtime/context.py | 11 |
3 files changed, 16 insertions, 3 deletions
diff --git a/meta/classes/testimage.bbclass b/meta/classes/testimage.bbclass index 09cc6d2a21..82557a8ede 100644 --- a/meta/classes/testimage.bbclass +++ b/meta/classes/testimage.bbclass | |||
@@ -229,6 +229,10 @@ def testimage_main(d): | |||
229 | 'kvm' : kvm, | 229 | 'kvm' : kvm, |
230 | } | 230 | } |
231 | 231 | ||
232 | # TODO: Currently BBPATH is needed for custom loading of targets. | ||
233 | # It would be better to find these modules using instrospection. | ||
234 | target_kwargs['target_modules_path'] = d.getVar('BBPATH') | ||
235 | |||
232 | # runtime use network for download projects for build | 236 | # runtime use network for download projects for build |
233 | export_proxies(d) | 237 | export_proxies(d) |
234 | 238 | ||
@@ -239,7 +243,7 @@ def testimage_main(d): | |||
239 | 243 | ||
240 | # the robot dance | 244 | # the robot dance |
241 | target = OERuntimeTestContextExecutor.getTarget( | 245 | target = OERuntimeTestContextExecutor.getTarget( |
242 | d.getVar("TEST_TARGET"), d.getVar("BBPATH"), None, d.getVar("TEST_TARGET_IP"), | 246 | d.getVar("TEST_TARGET"), None, d.getVar("TEST_TARGET_IP"), |
243 | d.getVar("TEST_SERVER_IP"), **target_kwargs) | 247 | d.getVar("TEST_SERVER_IP"), **target_kwargs) |
244 | 248 | ||
245 | # test context | 249 | # test context |
diff --git a/meta/lib/oeqa/core/target/qemu.py b/meta/lib/oeqa/core/target/qemu.py index 9d3f68cb64..2dc521c216 100644 --- a/meta/lib/oeqa/core/target/qemu.py +++ b/meta/lib/oeqa/core/target/qemu.py | |||
@@ -15,7 +15,7 @@ class OEQemuTarget(OESSHTarget): | |||
15 | def __init__(self, logger, ip, server_ip, timeout=300, user='root', | 15 | def __init__(self, logger, ip, server_ip, timeout=300, user='root', |
16 | port=None, machine='', rootfs='', kernel='', kvm=False, | 16 | port=None, machine='', rootfs='', kernel='', kvm=False, |
17 | dump_dir='', dump_host_cmds='', display='', bootlog='', | 17 | dump_dir='', dump_host_cmds='', display='', bootlog='', |
18 | tmpdir='', dir_image='', boottime=60): | 18 | tmpdir='', dir_image='', boottime=60, **kwargs): |
19 | 19 | ||
20 | super(OEQemuTarget, self).__init__(logger, ip, server_ip, timeout, | 20 | super(OEQemuTarget, self).__init__(logger, ip, server_ip, timeout, |
21 | user, port) | 21 | user, port) |
diff --git a/meta/lib/oeqa/runtime/context.py b/meta/lib/oeqa/runtime/context.py index ea1b4a643e..c4cd76cf44 100644 --- a/meta/lib/oeqa/runtime/context.py +++ b/meta/lib/oeqa/runtime/context.py | |||
@@ -89,7 +89,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor): | |||
89 | help="Qemu boot configuration, only needed when target_type is QEMU.") | 89 | help="Qemu boot configuration, only needed when target_type is QEMU.") |
90 | 90 | ||
91 | @staticmethod | 91 | @staticmethod |
92 | def getTarget(target_type, target_modules_path, logger, target_ip, server_ip, **kwargs): | 92 | def getTarget(target_type, logger, target_ip, server_ip, **kwargs): |
93 | target = None | 93 | target = None |
94 | 94 | ||
95 | if target_type == 'simpleremote': | 95 | if target_type == 'simpleremote': |
@@ -97,8 +97,17 @@ class OERuntimeTestContextExecutor(OETestContextExecutor): | |||
97 | elif target_type == 'qemu': | 97 | elif target_type == 'qemu': |
98 | target = OEQemuTarget(logger, target_ip, server_ip, **kwargs) | 98 | target = OEQemuTarget(logger, target_ip, server_ip, **kwargs) |
99 | else: | 99 | else: |
100 | # XXX: This code uses the old naming convention for controllers and | ||
101 | # targets, the idea it is to leave just targets as the controller | ||
102 | # most of the time was just a wrapper. | ||
103 | # XXX: This code tries to import modules from lib/oeqa/controllers | ||
104 | # directory and treat them as controllers, it will less error prone | ||
105 | # to use introspection to load such modules. | ||
106 | # XXX: Don't base your targets on this code it will be refactored | ||
107 | # in the near future. | ||
100 | # Custom target module loading | 108 | # Custom target module loading |
101 | try: | 109 | try: |
110 | target_modules_path = kwargs.get('target_modules_path', '') | ||
102 | controller = OERuntimeTestContextExecutor.getControllerModule(target_type, target_modules_path) | 111 | controller = OERuntimeTestContextExecutor.getControllerModule(target_type, target_modules_path) |
103 | target = controller(logger, target_ip, server_ip, **kwargs) | 112 | target = controller(logger, target_ip, server_ip, **kwargs) |
104 | except ImportError as e: | 113 | except ImportError as e: |