From: Cleber Rosa <crosa@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Caio Carrara" <ccarrara@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Samuel Ortiz" <sameo@linux.intel.com>,
"Cleber Rosa" <crosa@redhat.com>
Subject: [Qemu-devel] [PATCH v2 1/2] RFC: Acceptance tests: add the build directory to the system PATH
Date: Wed, 21 Nov 2018 16:48:17 -0500 [thread overview]
Message-ID: <20181121214818.22874-2-crosa@redhat.com> (raw)
In-Reply-To: <20181121214818.22874-1-crosa@redhat.com>
So that when binaries such as qemu-img are searched for, those in the
build tree will be favored. As a clarification, SRC_ROOT_DIR is
dependent on the location from where tests are executed, so they are
equal to the build directory if one is being used.
The original motivation is that Avocado libraries such as
avocado.utils.vmimage.get() may use the matching binaries, but it may
also apply to any other binary that test code may eventually attempt
to execute.
Other competing alternatives would be a more explicit path or binary
registration mechanism, in which we tell the libraries such as
avocado.utils.vmimage, the binaries to use in advance. I think the
model proposed here is simpler though, and is not inconsistent with
the general approach of favoring the built binaries, and falling back
to binaries available in the system. I'd love to have comments on
that, though.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
tests/acceptance/avocado_qemu/__init__.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 1e54fd5932..3d5190cbab 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -49,6 +49,15 @@ class Test(avocado.Test):
self.cancel("No QEMU binary defined or found in the source tree")
self.vm = QEMUMachine(self.qemu_bin)
+ # RFC: avocado.utils.vmimage.get() uses qemu-img, from the
+ # system's PATH, to create a snapshot. This is a transparent,
+ # but implicit way of making sure it finds the qemu-img that
+ # matches the code being tested (as tests it indirectly too).
+ # As for the cleanup, given that in the Avocado test execution
+ # model every test is started in a different process, no
+ # cleanup is needed.
+ os.environ['PATH'] = '%s:%s' % (SRC_ROOT_DIR, os.environ['PATH'])
+
def tearDown(self):
if self.vm is not None:
self.vm.shutdown()
--
2.19.1
next prev parent reply other threads:[~2018-11-21 21:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 21:48 [Qemu-devel] [PATCH v2 0/2] Add "boot_linux" acceptance test Cleber Rosa
2018-11-21 21:48 ` Cleber Rosa [this message]
2018-11-22 20:15 ` [Qemu-devel] [PATCH v2 1/2] RFC: Acceptance tests: add the build directory to the system PATH Wainer dos Santos Moschetta
2019-02-06 19:30 ` Cleber Rosa
2019-02-06 22:55 ` Philippe Mathieu-Daudé
2019-02-07 16:40 ` Cleber Rosa
2018-11-21 21:48 ` [Qemu-devel] [PATCH v2 2/2] Add "boot_linux" acceptance test Cleber Rosa
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=20181121214818.22874-2-crosa@redhat.com \
--to=crosa@redhat.com \
--cc=ccarrara@redhat.com \
--cc=ehabkost@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sameo@linux.intel.com \
--cc=wainersm@redhat.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;
as well as URLs for NNTP newsgroup(s).