From: Alexander Kanavin <alexander.kanavin@linux.intel.com>
To: "Yeoh, Ee Peng" <ee.peng.yeoh@intel.com>,
"openembedded-core@lists.openembedded.org"
<openembedded-core@lists.openembedded.org>
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>
Subject: Re: [PATCH] oe-selftest: crosstap: add tests for crosstap script
Date: Thu, 22 Mar 2018 13:38:26 +0200 [thread overview]
Message-ID: <a60cf40f-d4f3-c8a1-fa2b-42e31cc91518@linux.intel.com> (raw)
In-Reply-To: <9DDD2658D1FE414E99172D2DB1E4D04335DFA1B9@PGSMSX109.gar.corp.intel.com>
On 03/22/2018 02:50 AM, Yeoh, Ee Peng wrote:
> From my understanding, oeqa.utils.commands.runqemu will start and stop qemu in a single call.
That's not the case at all. Please look at the example below again:
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)
It starts qemu, then does things (qemu.run_serial() ) with that running
qemu instance. How and where qemu gets stopped is the 'magic' of 'with'
statement.
The key part is that runqemu() has a @contextmanager decorator and
contains this statement inside:
yield qemu
which 'suspends' the runqemu() execution and resumes the caller
function, passing it the qemu object. Once the 'with' block completes in
the caller, the runqemu() function is allowed to resume and clean up the
running qemu instance. It's definitely not a synchronous call/return
thing. You can read all about it here:
https://docs.python.org/3/library/contextlib.html
> For crosstap testcase, it require the steps below:
> - start qemu
> - call to crosstap to ssh into qemu to use systemtap
> - stop qemu
>
> Therefore, crosstap testcase use the oeqa.targetcontrol.QemuTarget (used by runqemu) to first start qemu, perform call to crosstap, then stop qemu.
runqemu() was written for precisely this use case.
Alex
next prev parent reply other threads:[~2018-03-22 11:45 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
2018-03-22 0:50 ` Yeoh, Ee Peng
2018-03-22 11:38 ` Alexander Kanavin [this message]
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=a60cf40f-d4f3-c8a1-fa2b-42e31cc91518@linux.intel.com \
--to=alexander.kanavin@linux.intel.com \
--cc=ee.peng.yeoh@intel.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=paul.eggleton@linux.intel.com \
/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