On Fri, Sep 26, 2025 at 12:44:58PM -0300, Gustavo Romero wrote:
> Hi Daniel,
> 
> On 9/26/25 05:50, Daniel P. Berrangé wrote:
> > On Fri, Sep 26, 2025 at 10:42:22AM +0200, Thomas Huth wrote:
> > > On 26/09/2025 10.37, Daniel P. Berrangé wrote:
> > > > On Fri, Sep 26, 2025 at 10:34:01AM +0200, Thomas Huth wrote:
> > > > > On 26/09/2025 07.15, Gustavo Romero wrote:
> > > > > > Add check-venv target as a dependency for the functional tests. This
> > > > > > causes Python modules listed in pythondeps.toml, under the testdeps
> > > > > > group, to be installed when 'make check-functional' is executed to
> > > > > > prepare and run the functional tests.
> > > > > > 
> > > > > > Signed-off-by: Gustavo Romero <[email protected]>
> > > > > > Suggested-by: Thomas Huth <[email protected]>
> > > > > > ---
> > > > > >     tests/Makefile.include | 2 +-
> > > > > >     1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > 
> > > > > > diff --git a/tests/Makefile.include b/tests/Makefile.include
> > > > > > index 3538c0c740..d012a9b25d 100644
> > > > > > --- a/tests/Makefile.include
> > > > > > +++ b/tests/Makefile.include
> > > > > > @@ -109,7 +109,7 @@ $(FUNCTIONAL_TARGETS):
> > > > > >             @$(MAKE) SPEED=thorough $(subst -functional,-func,$@)
> > > > > >     .PHONY: check-functional
> > > > > > -check-functional:
> > > > > > +check-functional: check-venv
> > > > > 
> > > > > I just noticed that there's still a problem: If you run "make
> > > > > check-functional-aarch64" immediately after configuring + compiling 
> > > > > QEMU in
> > > > > a fresh folder for the first time, the functional tests fail with:
> > > > > 
> > > > > ModuleNotFoundError: No module named 'pygdbmi'
> > > > > 
> > > > > We either need to add dependencies to the check-functional-<arch> 
> > > > > targets,
> > > > > too, or we have to make sure that tests still get properly skipped in 
> > > > > the
> > > > > case that pygdbmi has not been installed into the venv yet.
> > > > 
> > > > We already have a decorator for skipping tests when modules are missing,
> > > > so we should add usage of that.
> > > 
> > > Ack ... and the "from .gdb import GDB" in qemu_test/__init__.py likely 
> > > also
> > > has to go away, to avoid that each and every test tries to pull in the gdb
> > > code.
> > 
> > Or alternatively the gdb module can move the gdbmi import so that it is
> > only referenced in method scope, so it becomes relevant only when
> > executed.
> 
> I can´t follow what you meant here. Do mind expanding on it a bit?

The code currently does:

  from pygdbmi.gdbcontroller import GdbController

  class GDB:
      def __init__(self, gdb_path, echo=True, suffix='# ', prompt="$ "):
          gdb_cmd = [gdb_path, "-q", "--interpreter=mi2"]
          self.gdbmi = GdbController(gdb_cmd)
          self.echo = echo

but it could instead do

  class GDB:
      def __init__(self, gdb_path, echo=True, suffix='# ', prompt="$ "):
          gdb_cmd = [gdb_path, "-q", "--interpreter=mi2"]
          from pygdbmi.gdbcontroller import GdbController
          self.gdbmi = GdbController(gdb_cmd)
          self.echo = echo


so pygdbmi is only required if the GDB classs is instantiated
by a test, not when 'gdb.py' is imported

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|


Reply via email to