All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Daniel Berrange" <berrange@redhat.com>,
	"Beraldo Leal" <bleal@redhat.com>
Subject: Re: [PATCH 9/9] tests: run 'device-crash-test' from tests/venv
Date: Thu, 26 May 2022 10:14:52 -0400	[thread overview]
Message-ID: <CAFn=p-ZMwzcVSTDELNCPm6pCOS0PmRpZvUzGcyAumsXWFsCGAg@mail.gmail.com> (raw)
In-Reply-To: <319df99e-42d8-64dd-fbe8-a6f9311f3630@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3429 bytes --]

On Thu, May 26, 2022, 8:14 AM Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 5/26/22 02:09, John Snow wrote:
> > Remove the sys.path hacking from device-crash-test, and add in a little
> > user-friendly message for anyone who was used to running this script
> > directly from the source tree.
> >
> > Modify the GitLab job recipes to create the tests/venv first, then run
> > device-crash-test from that venv.
> >
> > Signed-off-by: John Snow <jsnow@redhat.com>
> > ---
> >   .gitlab-ci.d/buildtest.yml |  8 +++++---
> >   scripts/device-crash-test  | 14 +++++++++++---
> >   2 files changed, 16 insertions(+), 6 deletions(-)
> >
> > diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml
> > index e9620c30748..fde29c35aa3 100644
> > --- a/.gitlab-ci.d/buildtest.yml
> > +++ b/.gitlab-ci.d/buildtest.yml
> > @@ -110,7 +110,8 @@ crash-test-debian:
> >       IMAGE: debian-amd64
> >     script:
> >       - cd build
> > -    - scripts/device-crash-test -q ./qemu-system-i386
> > +    - make check-venv
> > +    - tests/venv/bin/python3 scripts/device-crash-test -q
> ./qemu-system-i386
> >
> >   build-system-fedora:
> >     extends: .native_build_job_template
> > @@ -155,8 +156,9 @@ crash-test-fedora:
> >       IMAGE: fedora
> >     script:
> >       - cd build
> > -    - scripts/device-crash-test -q ./qemu-system-ppc
> > -    - scripts/device-crash-test -q ./qemu-system-riscv32
> > +    - make check-venv
> > +    - tests/venv/bin/python3 scripts/device-crash-test -q
> ./qemu-system-ppc
> > +    - tests/venv/bin/python3 scripts/device-crash-test -q
> ./qemu-system-riscv32
> >
> >   build-system-centos:
> >     extends: .native_build_job_template
> > diff --git a/scripts/device-crash-test b/scripts/device-crash-test
> > index a203b3fdea2..73bcb986937 100755
> > --- a/scripts/device-crash-test
> > +++ b/scripts/device-crash-test
> > @@ -33,10 +33,18 @@ import re
> >   import random
> >   import argparse
> >   from itertools import chain
> > +from pathlib import Path
> >
> > -sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'python'))
> > -from qemu.machine import QEMUMachine
> > -from qemu.qmp import ConnectError
> > +try:
> > +    from qemu.machine import QEMUMachine
> > +    from qemu.qmp import ConnectError
> > +except ModuleNotFoundError as exc:
> > +    path = Path(__file__).resolve()
> > +    print(f"Module '{exc.name}' not found.")
> > +    print("  Try 'make check-venv' from your build directory,")
> > +    print("  and then one way to run this script is like so:")
> > +    print(f'  > $builddir/tests/venv/bin/python3 "{path}"')
> > +    sys.exit(1)
> >
> >   logger = logging.getLogger('device-crash-test')
> >   dbg = logger.debug
>
> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
>
> Even though I'd still prefer the venv to be setup early (so the
> check-venv change in buildtest.yml and the friendly message in the
> script will go away), this is a step in the right direction.
>
> Paolo
>

Agree, figured I'd do baby steps before I wound up with a 40 patch series,
and this gives Thomas et al a chance to find out if this ruins their
workflow.

(I'll probably keep the friendly message a little while more anyway,
though; to catch anyone who runs this script manually for a release or so.
I should add a section to our QEMU developer's guide and just link to it in
the message and explain the many, many ways you might enter a venv or
install the package.)

[-- Attachment #2: Type: text/html, Size: 4853 bytes --]

  reply	other threads:[~2022-05-26 14:22 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-26  0:09 [PATCH 0/9] tests, python: prepare to expand usage of test venv John Snow
2022-05-26  0:09 ` [PATCH 1/9] python: update for mypy 0.950 John Snow
2022-05-26  0:09 ` [PATCH 2/9] tests: add "TESTS_PYTHON" variable to Makefile John Snow
2022-05-26  0:09 ` [PATCH 3/9] tests: use python3 as the python executable name John Snow
2022-05-26 12:16   ` Paolo Bonzini
2022-05-26  0:09 ` [PATCH 4/9] tests: silence pip upgrade warnings during venv creation John Snow
2022-05-26 12:16   ` Paolo Bonzini
2022-05-26  0:09 ` [PATCH 5/9] tests: add quiet-venv-pip macro John Snow
2022-05-26 12:15   ` Paolo Bonzini
2022-05-26 14:17     ` John Snow
2022-05-26 19:54       ` Paolo Bonzini
2022-05-26 12:16   ` Paolo Bonzini
2022-05-26  0:09 ` [PATCH 6/9] tests: install "qemu" namespace package into venv John Snow
2022-05-26 12:15   ` Paolo Bonzini
2022-05-26  0:09 ` [PATCH 7/9] tests: use tests/venv to run basevm.py-based scripts John Snow
2022-05-26  0:09 ` [PATCH 8/9] tests: add python3-venv to debian10.docker John Snow
2022-05-26 12:14   ` Paolo Bonzini
2022-05-30  7:33   ` Thomas Huth
2022-05-31 18:28     ` John Snow
2022-06-01  7:29       ` Thomas Huth
2022-06-02 17:44         ` John Snow
2022-05-26  0:09 ` [PATCH 9/9] tests: run 'device-crash-test' from tests/venv John Snow
2022-05-26 12:14   ` Paolo Bonzini
2022-05-26 14:14     ` John Snow [this message]
2022-05-26 14:34 ` [PATCH 0/9] tests, python: prepare to expand usage of test venv John Snow
2022-06-01 10:06   ` Paolo Bonzini
2022-05-27 14:27 ` John Snow
2022-06-01 10:06   ` Paolo Bonzini
2022-06-02 17:43     ` John Snow

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='CAFn=p-ZMwzcVSTDELNCPm6pCOS0PmRpZvUzGcyAumsXWFsCGAg@mail.gmail.com' \
    --to=jsnow@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=bleal@redhat.com \
    --cc=crosa@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@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 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.