All of lore.kernel.org
 help / color / mirror / Atom feed
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 08/11] iotests: add testenv.py
Date: Thu, 21 Jan 2021 10:48:13 -0600	[thread overview]
Message-ID: <8088599e-fb3f-5296-6ced-12b09c911af2@redhat.com> (raw)
In-Reply-To: <20210116134424.82867-9-vsementsov@virtuozzo.com>

On 1/16/21 7:44 AM, Vladimir Sementsov-Ogievskiy wrote:
> Add TestEnv class, which will handle test environment in a new python
> iotests running framework.
> 
> Difference with current ./check interface:
> - -v (verbose) option dropped, as it is unused
> 
> - -xdiff option is dropped, until somebody complains that it is needed
> - same for -n option
> - same for looking for binaries in $build_iotests directory.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  tests/qemu-iotests/testenv.py | 255 ++++++++++++++++++++++++++++++++++
>  1 file changed, 255 insertions(+)
>  create mode 100644 tests/qemu-iotests/testenv.py
> 
> diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
> new file mode 100644
> index 0000000000..0fe5076088
> --- /dev/null
> +++ b/tests/qemu-iotests/testenv.py
> @@ -0,0 +1,255 @@
> +# TestEnv class to manage test environment variables.

Should this have permissions 755 and a #! python line?

> +def get_default_machine(qemu_prog: str) -> str:
> +    outp = subprocess.run([qemu_prog, '-machine', 'help'], check=True,
> +                          text=True, stdout=subprocess.PIPE).stdout
> +
> +    machines = outp.split('\n')
> +    default_machine = next(m for m in machines if m.endswith(' (default)'))
> +    default_machine = default_machine.split(' ', 1)[0]
> +
> +    alias_suf = ' (alias of {})'.format(default_machine)
> +    alias = next((m for m in machines if m.endswith(alias_suf)), None)
> +    if alias is not None:
> +        default_machine = alias.split(' ', 1)[0]
> +
> +    return default_machine

I have no idea if this is the most efficient and idiomatic way for
python to extract the default machine out of the output list, but it
seems to work.

> +
> +
> +class TestEnv(AbstractContextManager['TestEnv']):


> +        self.qsd_prog = os.getenv('QSD_PROG', root('storage-daemon',
> +                                                   'qemu-storage-daemon'))
> +
> +        for b in [self.qemu_img_prog, self.qemu_io_prog, self.qemu_nbd_prog,
> +                  self.qemu_prog, self.qsd_prog]:
> +            if not os.path.exists(b):
> +                sys.exit('Not such file: ' + b)

No such file


> +        if self.imgfmt == 'vmkd':

vmdk (which means we need to test that './check -vmdk' still works...)

I can see a rough correspondence to the existing shell code in ./check,
and with the entire series applied, things still work (other than vmdk,
which should work with the typo fix).  I'm not comfortable enough to
offer my full review of the python code, but I can give:

Tested-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2021-01-21 16:51 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 [this message]
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
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=8088599e-fb3f-5296-6ced-12b09c911af2@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.