From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: eesposit@redhat.com, qemu-block@nongnu.org, kwolf@redhat.com,
mreitz@redhat.com
Subject: Re: [PATCH 3/4] qemu-iotests: let "check" spawn an arbitrary test command
Date: Tue, 23 Mar 2021 19:43:30 +0300 [thread overview]
Message-ID: <ac3b47aa-344a-a6aa-a1d8-2c2dba2d540c@virtuozzo.com> (raw)
In-Reply-To: <20210323130614.146399-4-pbonzini@redhat.com>
23.03.2021 16:06, Paolo Bonzini wrote:
> Right now there is no easy way for "check" to print a reproducer command.
> Because such a reproducer command line would be huge, we can instead teach
> check to start a command of our choice. This can be for example a Python
> unit test with arguments to only run a specific subtest.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> tests/qemu-iotests/check | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
> index d1c87ceaf1..aab25dac6a 100755
> --- a/tests/qemu-iotests/check
> +++ b/tests/qemu-iotests/check
> @@ -19,6 +19,7 @@
> import os
> import sys
> import argparse
> +import shutil
> from findtests import TestFinder
> from testenv import TestEnv
> from testrunner import TestRunner
> @@ -100,8 +101,8 @@ def make_argparser() -> argparse.ArgumentParser:
> 'one to TEST (not inclusive). This may be used to '
> 'rerun failed ./check command, starting from the '
> 'middle of the process.')
> - g_sel.add_argument('tests', metavar='TEST_FILES', nargs='*',
> - help='tests to run')
> + g_sel.add_argument('tests', nargs=argparse.REMAINDER,
Interesting that REMAINDER documentation disappeared from latest (3.9) python documentation https://docs.python.org/3.9/library/argparse.html , but exists here https://docs.python.org/3.8/library/argparse.html (and no mark of deprecation)
> + help='tests to run, or "--" followed by a command')
>
> return p
>
> @@ -114,6 +115,17 @@ if __name__ == '__main__':
> imgopts=args.imgopts, misalign=args.misalign,
> debug=args.debug, valgrind=args.valgrind)
>
> + if args.tests[0] == '--':
> + del args.tests[0]
> + cmd = args.tests
> + env.print_env()
> + exec_path = shutil.which(cmd[0])
> + if exec_path is None:
> + sys.exit('command not found: ' + cmd[0])
> + cmd[0] = exec_path
> + full_env = env.prepare_subprocess(cmd)
> + os.execve(cmd[0], cmd, full_env)
> +
> testfinder = TestFinder(test_dir=env.source_iotests)
>
> groups = args.groups.split(',') if args.groups else None
>
I hope at some moment we'll run testcases with syntax like
./check -qcow2 test_name.ClassName.method_name
But a possibility to run any command under check script defined environment is a good thing anyway:
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
--
Best regards,
Vladimir
next prev parent reply other threads:[~2021-03-23 17:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-23 13:06 [PATCH 0/4] qemu-iotests: quality of life improvements Paolo Bonzini
2021-03-23 13:06 ` [PATCH 1/4] qemu-iotests: allow passing unittest.main arguments to the test scripts Paolo Bonzini
2021-03-23 14:34 ` Vladimir Sementsov-Ogievskiy
2021-03-23 15:29 ` Paolo Bonzini
2021-03-23 16:04 ` Vladimir Sementsov-Ogievskiy
2021-03-23 16:56 ` Vladimir Sementsov-Ogievskiy
2021-03-23 17:04 ` Paolo Bonzini
2021-03-23 17:27 ` Vladimir Sementsov-Ogievskiy
2021-03-23 17:35 ` Paolo Bonzini
2021-03-23 13:06 ` [PATCH 2/4] qemu-iotests: move command line and environment handling from TestRunner to TestEnv Paolo Bonzini
2021-03-23 16:22 ` Vladimir Sementsov-Ogievskiy
2021-03-23 13:06 ` [PATCH 3/4] qemu-iotests: let "check" spawn an arbitrary test command Paolo Bonzini
2021-03-23 16:43 ` Vladimir Sementsov-Ogievskiy [this message]
2021-03-23 17:00 ` Paolo Bonzini
2021-03-23 17:11 ` Vladimir Sementsov-Ogievskiy
2021-03-23 17:22 ` Paolo Bonzini
2021-03-23 17:39 ` Vladimir Sementsov-Ogievskiy
2021-03-23 13:06 ` [PATCH 4/4] qemu-iotests: fix case of SOCK_DIR already in the environment Paolo Bonzini
2021-03-23 16:45 ` Vladimir Sementsov-Ogievskiy
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=ac3b47aa-344a-a6aa-a1d8-2c2dba2d540c@virtuozzo.com \
--to=vsementsov@virtuozzo.com \
--cc=eesposit@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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).