]> code.ossystems Code Review - openembedded-core.git/commitdiff
oeqa/runtime/context.py: Fix use of getTarget() with testexport
authorMariano Lopez <mariano.lopez@linux.intel.com>
Tue, 21 Feb 2017 10:11:00 +0000 (10:11 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 23 Feb 2017 20:29:10 +0000 (12:29 -0800)
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.

Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/testimage.bbclass
meta/lib/oeqa/core/target/qemu.py
meta/lib/oeqa/runtime/context.py

index 09cc6d2a211285b5e128220f6e3d36944e3fdb0a..82557a8ede5a3d531af0bd110abac6bcd48c2f77 100644 (file)
@@ -229,6 +229,10 @@ def testimage_main(d):
                       'kvm'         : kvm,
                     }
 
+    # TODO: Currently BBPATH is needed for custom loading of targets.
+    # It would be better to find these modules using instrospection.
+    target_kwargs['target_modules_path'] = d.getVar('BBPATH')
+
     # runtime use network for download projects for build
     export_proxies(d)
 
@@ -239,7 +243,7 @@ def testimage_main(d):
 
     # the robot dance
     target = OERuntimeTestContextExecutor.getTarget(
-        d.getVar("TEST_TARGET"), d.getVar("BBPATH"), None, d.getVar("TEST_TARGET_IP"),
+        d.getVar("TEST_TARGET"), None, d.getVar("TEST_TARGET_IP"),
         d.getVar("TEST_SERVER_IP"), **target_kwargs)
 
     # test context
index 9d3f68cb647749e2f8c95a2365729b96748d9e84..2dc521c2165708bf4479a03e26dddacdb164f248 100644 (file)
@@ -15,7 +15,7 @@ class OEQemuTarget(OESSHTarget):
     def __init__(self, logger, ip, server_ip, timeout=300, user='root',
             port=None, machine='', rootfs='', kernel='', kvm=False,
             dump_dir='', dump_host_cmds='', display='', bootlog='',
-            tmpdir='', dir_image='', boottime=60):
+            tmpdir='', dir_image='', boottime=60, **kwargs):
 
         super(OEQemuTarget, self).__init__(logger, ip, server_ip, timeout,
                 user, port)
index ea1b4a643e8b1cf0d1da14bac3df23383aa5c2a9..c4cd76cf443effe9ddee4c2a08d7379d267b3cc4 100644 (file)
@@ -89,7 +89,7 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
                 help="Qemu boot configuration, only needed when target_type is QEMU.")
 
     @staticmethod
-    def getTarget(target_type, target_modules_path, logger, target_ip, server_ip, **kwargs):
+    def getTarget(target_type, logger, target_ip, server_ip, **kwargs):
         target = None
 
         if target_type == 'simpleremote':
@@ -97,8 +97,17 @@ class OERuntimeTestContextExecutor(OETestContextExecutor):
         elif target_type == 'qemu':
             target = OEQemuTarget(logger, target_ip, server_ip, **kwargs)
         else:
+            # XXX: This code uses the old naming convention for controllers and
+            # targets, the idea it is to leave just targets as the controller
+            # most of the time was just a wrapper.
+            # XXX: This code tries to import modules from lib/oeqa/controllers
+            # directory and treat them as controllers, it will less error prone
+            # to use introspection to load such modules.
+            # XXX: Don't base your targets on this code it will be refactored
+            # in the near future.
             # Custom target module loading
             try:
+                target_modules_path = kwargs.get('target_modules_path', '')
                 controller = OERuntimeTestContextExecutor.getControllerModule(target_type, target_modules_path)
                 target = controller(logger, target_ip, server_ip, **kwargs)
             except ImportError as e: