From: Cleber Rosa <crosa@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Samuel Ortiz" <sameo@linux.intel.com>
Subject: [Qemu-devel] [PATCH v6 2/7] Acceptance tests: keep a stable reference to the QEMU build dir
Date: Thu, 6 Jun 2019 17:14:09 -0400 [thread overview]
Message-ID: <20190606211414.8681-3-crosa@redhat.com> (raw)
In-Reply-To: <20190606211414.8681-1-crosa@redhat.com>
This is related to the the differences in in-tree and out-of-tree
builds in QEMU. For simplification, <BLD> means my build directory.
Currently, by running a `make check-acceptance` one gets (in
tests/acceptance/avocado_qemu/__init__.py):
SRC_ROOT_DIR: <BLD>/tests/acceptance/avocado_qemu/../../..
This in itself is problematic, because after the parent directories
are applied, one may be left not with a pointer to the build directory
as intended, but with the location of the source tree (assuming they
differ). Built binaries, such as qemu-img, are of course not there and
can't be found.
Given that a Python '__file__' will contain the absolute path to the
file backing the module, say:
__file__: <BLD>/tests/acceptance/avocado_qemu/__init__.py
| 4 | 3 | 2 | 1 |
A solution is to not "evaluate" the third parent dir (marked as 4
here) because that ends up following the "tests" directory symlink to
the source tree. In fact, there's no need to keep or evaluate any of
the parent directories, we can just drop the rightmost 4 components,
and we'll keep a stable reference to the build directory (with no
symlink being followed). This works for either a dedicated build
directory or also a combined source and build tree.
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
tests/acceptance/avocado_qemu/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 2b236a1cf0..ac59d36a4c 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -14,7 +14,7 @@ import uuid
import avocado
-SRC_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..')
+SRC_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
sys.path.append(os.path.join(SRC_ROOT_DIR, 'python'))
from qemu import QEMUMachine
--
2.21.0
next prev parent reply other threads:[~2019-06-06 21:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 21:14 [Qemu-devel] [PATCH v6 0/7] Add "boot_linux" acceptance test Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 1/7] Acceptance tests: use relative location for tests Cleber Rosa
2019-06-06 21:14 ` Cleber Rosa [this message]
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 3/7] Acceptance tests: add the build directory to the system PATH Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 4/7] Acceptance tests: depend on qemu-img Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 5/7] Add "boot_linux" test for x86_64 and pc and q35 machine types Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 6/7] Add "boot_linux" test for aarch64 and virt machine type Cleber Rosa
2019-06-06 21:14 ` [Qemu-devel] [PATCH v6 7/7] [RFC]: use Avocado data drainer for console logging Cleber Rosa
2019-06-06 23:03 ` [Qemu-devel] [PATCH v6 0/7] Add "boot_linux" acceptance test no-reply
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=20190606211414.8681-3-crosa@redhat.com \
--to=crosa@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=cohuck@redhat.com \
--cc=ehabkost@redhat.com \
--cc=fam@euphon.net \
--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).