diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2017-03-24 01:44:59 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-27 08:15:06 +0100 |
commit | b742fd023e71320990b26b979dd65632fbd347a2 (patch) | |
tree | 9454d7b5c045f3b4bb9d5ef17f54b6e0af95b5e1 /meta/lib/oeqa/utils/commands.py | |
parent | 58e6e7c2043d7f4b48ec3b4b9daf25f5766fa5d2 (diff) | |
download | poky-b742fd023e71320990b26b979dd65632fbd347a2.tar.gz |
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 <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils/commands.py')
-rw-r--r-- | meta/lib/oeqa/utils/commands.py | 13 |
1 files changed, 11 insertions, 2 deletions
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= | |||
218 | 218 | ||
219 | 219 | ||
220 | @contextlib.contextmanager | 220 | @contextlib.contextmanager |
221 | def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None): | 221 | def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None): |
222 | """ | ||
223 | launch_cmd means directly run the command, don't need set rootfs or env vars. | ||
224 | """ | ||
222 | 225 | ||
223 | import bb.tinfoil | 226 | import bb.tinfoil |
224 | import bb.build | 227 | import bb.build |
@@ -230,6 +233,12 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None): | |||
230 | import oeqa.targetcontrol | 233 | import oeqa.targetcontrol |
231 | tinfoil.config_data.setVar("TEST_LOG_DIR", "${WORKDIR}/testimage") | 234 | tinfoil.config_data.setVar("TEST_LOG_DIR", "${WORKDIR}/testimage") |
232 | tinfoil.config_data.setVar("TEST_QEMUBOOT_TIMEOUT", "1000") | 235 | tinfoil.config_data.setVar("TEST_QEMUBOOT_TIMEOUT", "1000") |
236 | # Tell QemuTarget() whether need find rootfs/kernel or not | ||
237 | if launch_cmd: | ||
238 | tinfoil.config_data.setVar("FIND_ROOTFS", '0') | ||
239 | else: | ||
240 | tinfoil.config_data.setVar("FIND_ROOTFS", '1') | ||
241 | |||
233 | recipedata = tinfoil.parse_recipe(pn) | 242 | recipedata = tinfoil.parse_recipe(pn) |
234 | 243 | ||
235 | # The QemuRunner log is saved out, but we need to ensure it is at the right | 244 | # 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): | |||
260 | try: | 269 | try: |
261 | qemu.deploy() | 270 | qemu.deploy() |
262 | try: | 271 | try: |
263 | qemu.start(ssh=ssh, runqemuparams=runqemuparams) | 272 | qemu.start(ssh=ssh, runqemuparams=runqemuparams, launch_cmd=launch_cmd) |
264 | except bb.build.FuncFailed: | 273 | except bb.build.FuncFailed: |
265 | raise Exception('Failed to start QEMU - see the logs in %s' % logdir) | 274 | raise Exception('Failed to start QEMU - see the logs in %s' % logdir) |
266 | 275 | ||