From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH for 10.1 v2 14/14] tests/functional: expose sys.argv to unittest.main
Date: Fri, 25 Jul 2025 16:45:17 +0100 [thread overview]
Message-ID: <20250725154517.3523095-15-alex.bennee@linaro.org> (raw)
In-Reply-To: <20250725154517.3523095-1-alex.bennee@linaro.org>
With this we can call the supported we can take advantage of the
argument the module supports:
env PYTHONPATH=/home/alex/lsrc/qemu.git/python:/home/alex/lsrc/qemu.git/tests/functional ./pyvenv/bin/python /home/alex/lsrc/qemu.git/tests/functional/test_aarch64_kvm.py --help
usage: test_aarch64_kvm.py [-h] [-v] [-q] [--locals] [--durations N] [-f] [-c] [-b] [-k TESTNAMEPATTERNS] [tests ...]
positional arguments:
tests a list of any number of test modules, classes and test methods.
options:
-h, --help show this help message and exit
-v, --verbose Verbose output
-q, --quiet Quiet output
--locals Show local variables in tracebacks
--durations N Show the N slowest test cases (N=0 for all)
-f, --failfast Stop on first fail or error
-c, --catch Catch Ctrl-C and display results so far
-b, --buffer Buffer stdout and stderr during tests
-k TESTNAMEPATTERNS Only run tests which match the given substring
Examples:
test_aarch64_kvm.py test_module - run tests from test_module
test_aarch64_kvm.py module.TestClass - run tests from module.TestClass
test_aarch64_kvm.py module.Class.test_method - run specified test method
test_aarch64_kvm.py path/to/test_file.py - run tests from test_file.py
usage: test_aarch64_kvm.py discover [-h] [-v] [-q] [--locals] [--durations N] [-f] [-c] [-b] [-k TESTNAMEPATTERNS] [-s START] [-p PATTERN] [-t TOP]
options:
-h, --help show this help message and exit
-v, --verbose Verbose output
-q, --quiet Quiet output
--locals Show local variables in tracebacks
--durations N Show the N slowest test cases (N=0 for all)
-f, --failfast Stop on first fail or error
-c, --catch Catch Ctrl-C and display results so far
-b, --buffer Buffer stdout and stderr during tests
-k TESTNAMEPATTERNS Only run tests which match the given substring
-s, --start-directory START
Directory to start discovery ('.' default)
-p, --pattern PATTERN
Pattern to match tests ('test*.py' default)
-t, --top-level-directory TOP
Top level directory of project (defaults to start directory)
For test discovery all test modules must be importable from the top level directory of the project.
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/functional/qemu_test/testcase.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py
index 2a78e735f16..5caf7b13fe3 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -249,7 +249,7 @@ def main():
tr = pycotap.TAPTestRunner(message_log = pycotap.LogMode.LogToError,
test_output_log = pycotap.LogMode.LogToError)
res = unittest.main(module = None, testRunner = tr, exit = False,
- argv=["__dummy__", path])
+ argv=[sys.argv[0], path] + sys.argv[1:])
for (test, message) in res.result.errors + res.result.failures:
if hasattr(test, "log_filename"):
--
2.47.2
prev parent reply other threads:[~2025-07-25 15:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-25 15:45 [PATCH for 10.1 v2 00/14] documentation updates and test tweaks pre-PR Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 01/14] docs/user: clarify user-mode expects the same OS Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 02/14] docs/system: reword the TAP notes to remove tarball ref Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 03/14] docs/user: clean up headings Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 04/14] docs/user: slightly reword section on system calls Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 05/14] docs/user: expand section on threading Alex Bennée
2025-07-25 19:57 ` Richard Henderson
2025-07-25 15:45 ` [PATCH for 10.1 v2 06/14] tests/functional: add hypervisor test for aarch64 Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 07/14] tests/tcg: skip libsyscall.so on softmmu tests Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 08/14] tests/tcg: remove ADDITIONAL_PLUGINS_TESTS Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 09/14] tests/tcg: don't include multiarch tests if not supported Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 10/14] configure: expose PYTHON to test/tcg/config-host.mak Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 11/14] tests/tcg: reduce the number of plugin tests combinations Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 12/14] tests/docker: add --arch-only to qemu deps for all-test-cross Alex Bennée
2025-07-25 15:45 ` [PATCH for 10.1 v2 13/14] tests/docker: handle host-arch selection " Alex Bennée
2025-07-25 15:45 ` Alex Bennée [this message]
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=20250725154517.3523095-15-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@linaro.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).