From b742fd023e71320990b26b979dd65632fbd347a2 Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Fri, 24 Mar 2017 01:44:59 -0700 Subject: oeqa/targetcontrol.py: modify it to test runqemu Modify the following files to test runqemu: targetcontrol.py utils/commands.py utils/qemurunner.py We need simulate how "runqemu" works in command line, so when test "runqemu", the targetcontrol.py, utils/commands.py and utils/qemurunner.py don't have to find the rootfs or set env vars. [YOCTO #10249] (From OE-Core rev: 9305d816bdf8837ea3a407091cb7f24a9a3ae8dc) Signed-off-by: Robert Yang Signed-off-by: Richard Purdie --- meta/lib/oeqa/utils/commands.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'meta/lib/oeqa/utils/commands.py') diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 82c5908e9c..6528a98427 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -218,7 +218,10 @@ def create_temp_layer(templayerdir, templayername, priority=999, recipepathspec= @contextlib.contextmanager -def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None): +def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None): + """ + launch_cmd means directly run the command, don't need set rootfs or env vars. + """ import bb.tinfoil import bb.build @@ -230,6 +233,12 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None): import oeqa.targetcontrol tinfoil.config_data.setVar("TEST_LOG_DIR", "${WORKDIR}/testimage") tinfoil.config_data.setVar("TEST_QEMUBOOT_TIMEOUT", "1000") + # Tell QemuTarget() whether need find rootfs/kernel or not + if launch_cmd: + tinfoil.config_data.setVar("FIND_ROOTFS", '0') + else: + tinfoil.config_data.setVar("FIND_ROOTFS", '1') + recipedata = tinfoil.parse_recipe(pn) # The QemuRunner log is saved out, but we need to ensure it is at the right @@ -260,7 +269,7 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None): try: qemu.deploy() try: - qemu.start(ssh=ssh, runqemuparams=runqemuparams) + qemu.start(ssh=ssh, runqemuparams=runqemuparams, launch_cmd=launch_cmd) except bb.build.FuncFailed: raise Exception('Failed to start QEMU - see the logs in %s' % logdir) -- cgit v1.2.3-54-g00ecf