From: Alexander Kanavin <alexander.kanavin@linux.intel.com>
To: Yeoh Ee Peng <ee.peng.yeoh@intel.com>,
openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] oe-selftest: crosstap: add tests for crosstap script
Date: Wed, 21 Mar 2018 15:45:01 +0200 [thread overview]
Message-ID: <cec1c204-c8c1-74da-d89d-bba2ed0d369c@linux.intel.com> (raw)
In-Reply-To: <1521503987-70014-1-git-send-email-ee.peng.yeoh@intel.com>
On 03/20/2018 01:59 AM, Yeoh Ee Peng wrote:
> + def start_qemu_with_image(self, recipe, fstypes, cmd, targetlogger):
> + tinfoil = bb.tinfoil.Tinfoil()
> + tinfoil.prepare(config_only=False, quiet=True)
> + try:
> + tinfoil.logger.setLevel(logging.WARNING)
> + 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
> + #tinfoil.config_data.setVar("FIND_ROOTFS", '0')
> + recipedata = tinfoil.parse_recipe(recipe)
> + logdir = recipedata.getVar("TEST_LOG_DIR")
> + qemu = oeqa.targetcontrol.QemuTarget(recipedata, targetlogger, fstypes)
> + finally:
> + # We need to shut down tinfoil early here in case we actually want
> + # to run tinfoil-using utilities with the running QEMU instance.
> + # Luckily QemuTarget doesn't need it after the constructor.
> + tinfoil.shutdown()
> + print('DEBUG: qemu.deploy')
> + qemu.deploy()
> + try:
> + print('DEBUG: qemu.start')
> + qemu.start(ssh=True, launch_cmd=cmd, discard_writes=True)
> + except bb.build.FuncFailed:
> + raise Exception('Failed to start QEMU - see the logs in %s' % logdir)
> +
> + return qemu
Can you use runqemu from oeqa.utils.commands, instead of this custom
hand-written invocation? There are plenty of examples in oe-selftests, e.g.:
with runqemu('core-image-minimal') as qemu:
# Make the test echo a string and search for
that as
# run_serial()'s status code is useless.'
for filename in ("rootfs", "delayed-a",
"delayed-b"):
status, output = qemu.run_serial("test -f
%s && echo found" % os.path.join(targettestdir, filename))
self.assertEqual(output, "found", "%s was
not present on boot" % filename)
Alex
next prev parent reply other threads:[~2018-03-21 13:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-19 23:59 [PATCH] oe-selftest: crosstap: add tests for crosstap script Yeoh Ee Peng
2018-03-20 9:58 ` Alexander Kanavin
2018-03-21 13:45 ` Alexander Kanavin [this message]
2018-03-22 0:50 ` Yeoh, Ee Peng
2018-03-22 11:38 ` Alexander Kanavin
2018-03-23 1:32 ` Yeoh, Ee Peng
-- strict thread matches above, loose matches on Subject: below --
2018-03-27 1:37 Yeoh Ee Peng
2018-03-27 10:31 ` Alexander Kanavin
2018-03-28 0:41 ` Yeoh, Ee Peng
2018-04-10 18:32 Yeoh Ee Peng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cec1c204-c8c1-74da-d89d-bba2ed0d369c@linux.intel.com \
--to=alexander.kanavin@linux.intel.com \
--cc=ee.peng.yeoh@intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox