[oe-commits] [openembedded-core] 02/13: oeqa: allow customizing image used by runqemu()

git at git.openembedded.org git at git.openembedded.org
Mon Mar 27 21:09:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 72ebf8bbd39324aefa33b6f7da747d8c5ea41c8e
Author: Patrick Ohly <patrick.ohly at intel.com>
AuthorDate: Mon Mar 27 21:39:13 2017 +0200

    oeqa: allow customizing image used by runqemu()
    
    runqemu() takes all parameters for the virtual machine from the
    variables of the given recipe. By allowing the caller to provide a
    hash with variables that get applied locally, the caller gets more
    control.
    
    Here's the intended usage:
    
       <prepare internal-image in self.resultdir>
       overrides = {
            'DEPLOY_DIR_IMAGE': self.resultdir,
            'IMAGE_LINK_NAME': 'internal-image-%s' % self.image_arch,
       }
       with runqemu('refkit-installer-image', ssh=False,
                     overrides=overrides) as qemu:
           ....
    
    This can be used to replace the image completely with something else
    or to copy it before allowing runqemu() to write into it.
    
    Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/utils/commands.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 3dfff0f..88c9bb1 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -225,7 +225,7 @@ def create_temp_layer(templayerdir, templayername, priority=999, recipepathspec=
 
 
 @contextlib.contextmanager
-def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None, qemuparams=None):
+def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None, qemuparams=None, overrides={}):
     """
     launch_cmd means directly run the command, don't need set rootfs or env vars.
     """
@@ -247,6 +247,8 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None,
             tinfoil.config_data.setVar("FIND_ROOTFS", '1')
 
         recipedata = tinfoil.parse_recipe(pn)
+        for key, value in overrides.items():
+            recipedata.setVar(key, value)
 
         # The QemuRunner log is saved out, but we need to ensure it is at the right
         # log level (and then ensure that since it's a child of the BitBake logger,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list