From: John Snow <jsnow@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
qemu-block@nongnu.org, "Beraldo Leal" <bleal@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"John Snow" <jsnow@redhat.com>, "Kevin Wolf" <kwolf@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [PATCH RFC 5/6] iotests: use pyvenv/bin/python3 to launch child test processes
Date: Tue, 20 Jun 2023 20:21:20 -0400 [thread overview]
Message-ID: <20230621002121.1609612-6-jsnow@redhat.com> (raw)
In-Reply-To: <20230621002121.1609612-1-jsnow@redhat.com>
Now that there's a fancy venv set up for us by configure, we should take
care to use it even when check is invoked directly.
./check will now use the pyvenv environment when launching python tests,
which allows those tests to find and access the 'qemu.*' packages
without PYTHONPATH modifications.
RFC: This patch now means that ./check may launch test subprocesses
using a different Python than the one used to launch it. If that isn't
acceptable, we might need a launcher shim whose job it is to sit above
"check" and just chooses the correct Python.
...Or maybe it's fine the way it is.
Comments welcome, sorry for my indecision.
Signed-off-by: John Snow <jsnow@redhat.com>
---
tests/qemu-iotests/testenv.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
index e67ebd254b..1b095d70f2 100644
--- a/tests/qemu-iotests/testenv.py
+++ b/tests/qemu-iotests/testenv.py
@@ -138,7 +138,20 @@ def init_binaries(self) -> None:
PYTHON (for bash tests)
QEMU_PROG, QEMU_IMG_PROG, QEMU_IO_PROG, QEMU_NBD_PROG, QSD_PROG
"""
- self.python = sys.executable
+ # The python we want to use to launch tests.
+ self.python: str = str(
+ Path(self.build_root).joinpath('pyvenv', 'bin', 'python3')
+ )
+ # RFC: Do I need to amend '.exe' for windows, or nah?
+
+ if self.python != sys.executable:
+ print(
+ "Note: "
+ f"check was launched with a Python ({sys.executable}) "
+ f"that doesn't match QEMU's configured Python ({self.python})."
+ " QEMU's Python will be used for individual test processes.",
+ file=sys.stderr
+ )
def root(*names: str) -> str:
return os.path.join(self.build_root, *names)
--
2.40.1
next prev parent reply other threads:[~2023-06-21 0:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 0:21 [PATCH RFC 0/6] Switch iotests to pyvenv John Snow
2023-06-21 0:21 ` [PATCH RFC 1/6] experiment: add mkvenv install John Snow
2023-06-21 0:21 ` [PATCH RFC 2/6] build, tests: Add qemu in-tree packages to pyvenv at configure time John Snow
2023-06-21 0:21 ` [PATCH RFC 3/6] iotests: get rid of '..' in path environment output John Snow
2023-06-21 0:21 ` [PATCH RFC 4/6] iotests: use the correct python to run linters John Snow
2023-06-21 0:21 ` John Snow [this message]
2023-06-21 0:21 ` [PATCH RFC 6/6] iotests: don't add qemu.git/python to PYTHONPATH John Snow
2023-06-21 7:08 ` [PATCH RFC 0/6] Switch iotests to pyvenv Paolo Bonzini
2023-06-22 9:24 ` Paolo Bonzini
2023-06-22 21:03 ` John Snow
2023-06-22 21:04 ` Paolo Bonzini
2023-06-22 21:07 ` John Snow
2023-06-22 21:11 ` Paolo Bonzini
2023-06-22 21:18 ` John Snow
2023-06-22 21:57 ` Paolo Bonzini
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=20230621002121.1609612-6-jsnow@redhat.com \
--to=jsnow@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=bleal@redhat.com \
--cc=crosa@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=thuth@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).