From: Eric Blake <eblake@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
qemu-block@nongnu.org
Cc: kwolf@redhat.com, den@openvz.org, jsnow@redhat.com,
qemu-devel@nongnu.org, mreitz@redhat.com
Subject: Re: [PATCH v7 10/11] iotests: rewrite check into python
Date: Thu, 21 Jan 2021 11:22:59 -0600 [thread overview]
Message-ID: <4b50156b-e5ca-f3f4-32de-6ce540640aef@redhat.com> (raw)
In-Reply-To: <20210116134424.82867-11-vsementsov@virtuozzo.com>
On 1/16/21 7:44 AM, Vladimir Sementsov-Ogievskiy wrote:
> Just use classes introduced in previous three commits. Behavior
> difference is described in these three commits.
>
> Drop group file, as it becomes unused.
>
> Drop common.env: now check is in python, and for tests we use same
> python interpreter that runs the check itself. Use build environment
> PYTHON in check-block instead, to keep "make check" use the same
> python.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
> +++ b/tests/qemu-iotests/check
> @@ -1,7 +1,8 @@
> -#!/usr/bin/env bash
> +#!/usr/bin/env python3
> #
> -# Copyright (C) 2009 Red Hat, Inc.
> -# Copyright (c) 2000-2002,2006 Silicon Graphics, Inc. All Rights Reserved.
> +# Configure environment and run group of tests in it.
> +#
> +# Copyright (c) 2020-2021 Virtuozzo International GmbH
Normally dropping old copyrights is suspicious, but as this is a
complete rewrite, it makes sense here.
> -exit
> +import os
> +import sys
> +import argparse
> +from findtests import TestFinder
> +from testenv import TestEnv
> +from testrunner import TestRunner
> +
> +
> +def make_argparser() -> argparse.ArgumentParser:
> + p = argparse.ArgumentParser(description="Test run options")
> +
> + p.add_argument('-n', '--dry-run', action='store_true',
> + help='show me, do not run tests')
> + p.add_argument('-makecheck', action='store_true',
> + help='pretty print output for make check')
> +
> + p.add_argument('-d', dest='debug', action='store_true', help='debug')
> + p.add_argument('-misalign', action='store_true',
> + help='misalign memory allocations')
> +
> + g_env = p.add_argument_group('test environment options')
> + mg = g_env.add_mutually_exclusive_group()
> + # We don't set default for cachemode, as we need to distinguish dafult
default
> + # from user input later.
> + mg.add_argument('-nocache', dest='cachemode', action='store_const',
> + const='none', help='set cache mode "none" (O_DIRECT), '
> + 'sets CACHEMODE environment variable')
> + mg.add_argument('-c', dest='cachemode',
> + help='sets CACHEMODE environment variable')
> +
> + g_env.add_argument('-i', dest='aiomode', default='threads',
> + help='sets AIOMODE environment variable')
> +
> + p.set_defaults(imgfmt='raw', imgproto='file')
> +
> + format_list = ['raw', 'bochs', 'cloop', 'parallels', 'qcow', 'qcow2',
> + 'qed', 'vdi', 'vpc', 'vhdx', 'vmdk', 'luks', 'dmg']
> + g_fmt = p.add_argument_group(
> + ' image format options',
> + 'The following options set the IMGFMT environment variable. '
> + 'At most one choice is allowed, default is "raw"')
> + mg = g_fmt.add_mutually_exclusive_group()
> + for fmt in format_list:
> + mg.add_argument('-' + fmt, dest='imgfmt', action='store_const',
> + const=fmt, help=f'test {fmt}')
> +
> + protocol_list = ['file', 'rbd', 'sheepdoc', 'nbd', 'ssh', 'nfs',
sheepdog
> + 'fuse']
> + g_prt = p.add_argument_group(
> + ' image protocol options',
> + 'The following options set the IMGPROTO environment variable. '
> + 'At most one choice is allowed, default is "file"')
> + mg = g_prt.add_mutually_exclusive_group()
> + for prt in protocol_list:
> + mg.add_argument('-' + prt, dest='imgproto', action='store_const',
> + const=prt, help=f'test {prt}')
> +
> + g_bash = p.add_argument_group('bash tests options',
> + 'The following options are ignored by '
> + 'python tests.')
> + # TODO: make support for the following options in iotests.py
> + g_bash.add_argument('-o', dest='imgopts',
> + help='options to pass to qemu-img create/convert, '
> + 'sets IMGOPTS environment variable')
> + g_bash.add_argument('-valgrind', dest='VALGRIND_QEMU',
> + action='store_const', const='y',
> + help='use valgrind, sets VALGRIND_QEMU environment '
> + 'variable')
> +
> + g_sel = p.add_argument_group('test selecting options',
> + 'The following options specify test set '
> + 'to run.')
> + g_sel.add_argument('-g', '--groups', metavar='group1,...',
> + help='include tests from these groups')
> + g_sel.add_argument('-x', '--exclude-groups', metavar='group1,...',
> + help='exclude tests from these groups')
> + g_sel.add_argument('--start-from', metavar='TEST',
> + help='Start from specified test: make sorted sequence '
> + 'of tests as usual and then drop tests from the first '
> + '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')
> +
> + return p
The change to drop ranges and instead use --start-from makes sense (you
can't do ranges of named files); it will take a minor adjustment to my
keyboarding habits to get used to, but I don't see it as a show-stopper
as iotests are for developers and not promised to be a stable interface.
> +
> +
> +if __name__ == '__main__':
> + args = make_argparser().parse_args()
> +
> + env = TestEnv(imgfmt=args.imgfmt, imgproto=args.imgproto,
> + aiomode=args.aiomode, cachemode=args.cachemode,
> + imgopts=args.imgopts, misalign=args.misalign,
> + debug=args.debug)
> +
> + testfinder = TestFinder(test_dir=env.source_iotests)
> +
> + groups = args.groups.split(',') if args.groups else None
> + x_groups = args.exlude_groups.split(',') if args.exclude_groups else None
> +
> + try:
> + tests = testfinder.find_tests(groups=groups, exclude_groups=x_groups,
> + tests=args.tests,
> + start_from=args.start_from)
> + if not tests:
> + raise ValueError('No tests selected')
> + except ValueError as e:
> + sys.exit(e)
> +
> + if args.dry_run:
> + print('\n'.join(tests))
> + else:
> + with TestRunner(env, args.makecheck) as tr:
> + tr.run_tests([os.path.join(env.source_iotests, t) for t in tests])
Other than the typo, this looks like a fairly straightforward conversion
of the old shell code, but at present, I'm only comfortable giving:
Tested-by: Eric Blake <eblake@redhat.com>
(of course assuming you fix the typo that broke ./check -sheepdog)
The longer we sit on this series, the more merge conflicts it will
introduce (new tests need to add their own #group header line); the
changes to fix those conflicts should be obvious, but I hope we get
another reviewer soon. I'm wondering if I should take the second half
of this series (since I already sent the pull request for the first half
since it touched NBD tests), or let Max take it.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2021-01-21 17:32 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-16 13:44 [PATCH v7 00/11] Rework iotests/check Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 01/11] iotests/277: use dot slash for nbd-fault-injector.py running Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 02/11] iotests/303: use dot slash for qcow2.py running Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 03/11] iotests: fix some whitespaces in test output files Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 04/11] iotests: make tests executable Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 05/11] iotests/294: add shebang line Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 06/11] iotests: define group in each iotest Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 07/11] iotests: add findtests.py Vladimir Sementsov-Ogievskiy
2021-01-21 16:18 ` Eric Blake
2021-01-21 16:21 ` Eric Blake
2021-01-21 16:57 ` Vladimir Sementsov-Ogievskiy
2021-01-22 11:48 ` Kevin Wolf
2021-01-22 11:57 ` Vladimir Sementsov-Ogievskiy
2021-01-22 12:45 ` Kevin Wolf
2021-01-22 13:16 ` Vladimir Sementsov-Ogievskiy
2021-01-22 13:34 ` Kevin Wolf
2021-01-22 13:52 ` Vladimir Sementsov-Ogievskiy
2021-01-22 11:49 ` Kevin Wolf
2021-01-22 11:59 ` Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 08/11] iotests: add testenv.py Vladimir Sementsov-Ogievskiy
2021-01-21 16:48 ` Eric Blake
2021-01-21 17:03 ` Vladimir Sementsov-Ogievskiy
2021-01-22 14:34 ` Kevin Wolf
2021-01-16 13:44 ` [PATCH v7 09/11] iotests: add testrunner.py Vladimir Sementsov-Ogievskiy
2021-01-21 17:02 ` Eric Blake
2021-01-21 17:17 ` Vladimir Sementsov-Ogievskiy
2021-01-22 14:11 ` Kevin Wolf
2021-01-22 14:22 ` Vladimir Sementsov-Ogievskiy
2021-01-22 14:51 ` Kevin Wolf
2021-01-22 15:01 ` Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 10/11] iotests: rewrite check into python Vladimir Sementsov-Ogievskiy
2021-01-21 17:22 ` Eric Blake [this message]
2021-01-22 13:53 ` Vladimir Sementsov-Ogievskiy
2021-01-22 16:08 ` Kevin Wolf
2021-01-23 15:08 ` Vladimir Sementsov-Ogievskiy
2021-01-25 12:02 ` Kevin Wolf
2021-01-25 12:31 ` Vladimir Sementsov-Ogievskiy
2021-01-16 13:44 ` [PATCH v7 11/11] iotests: rename and move 169 and 199 tests Vladimir Sementsov-Ogievskiy
2021-01-20 20:52 ` [PATCH v7 00/11] Rework iotests/check Eric Blake
2021-01-22 11:27 ` Kevin Wolf
2021-01-22 11:32 ` Vladimir Sementsov-Ogievskiy
2021-01-22 16:08 ` Eric Blake
2021-01-22 16:18 ` Kevin Wolf
2021-01-21 15:08 ` Paolo Bonzini
2021-01-22 16:16 ` Kevin Wolf
2021-01-23 15:14 ` 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=4b50156b-e5ca-f3f4-32de-6ce540640aef@redhat.com \
--to=eblake@redhat.com \
--cc=den@openvz.org \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.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).