All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: "Gustavo Romero" <gustavo.romero@linaro.org>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [RFC PATCH 2/2] tests/functional: Adapt reverse_debugging to run w/o Avocado
Date: Tue, 16 Sep 2025 10:22:27 +0100	[thread overview]
Message-ID: <aMksU3AtgkuGsYcG@redhat.com> (raw)
In-Reply-To: <20250915124207.42053-3-thuth@redhat.com>

On Mon, Sep 15, 2025 at 02:42:07PM +0200, Thomas Huth wrote:
> From: Gustavo Romero <gustavo.romero@linaro.org>
> 
> This commit removes Avocado as a dependency for running the
> reverse_debugging test.
> 
> The main benefit, beyond eliminating an extra dependency, is that there
> is no longer any need to handle GDB packets manually. This removes the
> need for ad-hoc functions dealing with endianness and arch-specific
> register numbers, making the test easier to read. The timeout variable
> is also removed, since Meson now manages timeouts automatically.
> 
> The reverse_debugging test is now executed through running GDB via a
> python script. The test itself is only responsible for invoking
> GDB with the appropriate arguments and for passing the test script to
> GDB.
> 
> reverse_debugging is kept "skipped" for aarch64, ppc64, and x86_64, so
> won't run unless QEMU_TEST_FLAKY_TESTS=1 is set in the test environment,
> before running 'make check-functional' or 'meson test [...]'.
> 
> Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
> [thuth: Rework the test to run without tests/guest-debug/run-test.py]
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  .../functional/aarch64/test_reverse_debug.py  |  16 +-
>  tests/functional/ppc64/test_reverse_debug.py  |  18 +-
>  tests/functional/reverse_debugging.py         | 235 +++++++++++-------
>  tests/functional/x86_64/test_reverse_debug.py |  20 +-
>  4 files changed, 171 insertions(+), 118 deletions(-)
> 

snip

>  
> -        # assume that none of the first instructions is executed again
> -        # breaking the order of the breakpoints
> -        self.check_pc(g, steps[-1])
> -        logger.info('successfully reached %x' % steps[-1])
> +        # Assume that none of the first instructions is executed again
> +        # breaking the order of the breakpoints.
> +        # steps[-1] is the first saved $pc in reverse order.
> +        self.check_pc(steps[-1])
> +        logger.info('Successfully reached %x' % steps[-1])
>  
> -        logger.info('exiting gdb and qemu')
> +        logger.info('Exiting GDB and QEMU...')
> +        # Disconnect from the VM.
> +        gdb.execute("disconnect")
> +        # Guarantee VM is shutdown.
>          vm.shutdown()
> +        # Gently exit from GDB.
> +        gdb.execute('print "test succeeded"')
> +        gdb.execute("exit 0")

This causes immediate terminatino of the python program which prevents
any of the tearDown cleanup logic from running.

> +
> +    @staticmethod
> +    def main():
> +        try:
> +            LinuxKernelTest.main()
> +        except SystemExit:
> +            # If the test is marked with @skipFlakyTest, then it will be exited
> +            # via sys.exit() before we have the chance to exit from GDB gently.
> +            # Because recent versions of GDB will return a failure value if this
> +            # happens, we catch the SystemExit and exit from GDB gently with 77,
> +            # which meson interprets correctly as a skipped test.
> +            gdb.execute("exit 77")
> +
> +if __name__ == '__main__':
> +    if not _has_gdb:
> +        sys.exit("This script must be launched via tests/guest-debug/run-test.py!")

This is incorrect.

> +    ReverseDebugging.main()


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 :|



  parent reply	other threads:[~2025-09-16  9:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-15 12:42 [RFC PATCH 0/2] tests/functional: Adapt reverse_debugging to run w/o Avocado (yet another try) Thomas Huth
2025-09-15 12:42 ` [RFC PATCH 1/2] tests/functional: Provide GDB to the functional tests Thomas Huth
2025-09-15 16:11   ` Alex Bennée
2025-09-15 22:02   ` Gustavo Romero
2025-09-16  9:20     ` Daniel P. Berrangé
2025-09-15 12:42 ` [RFC PATCH 2/2] tests/functional: Adapt reverse_debugging to run w/o Avocado Thomas Huth
2025-09-15 16:14   ` Alex Bennée
2025-09-15 22:02   ` Gustavo Romero
2025-09-16  9:22   ` Daniel P. Berrangé [this message]
2025-09-15 16:13 ` [RFC PATCH 0/2] tests/functional: Adapt reverse_debugging to run w/o Avocado (yet another try) Alex Bennée
2025-09-15 16:18   ` Thomas Huth
2025-09-15 18:27     ` Alex Bennée
2025-09-15 22:03     ` Gustavo Romero
2025-09-15 22:02 ` Gustavo Romero
2025-09-16  9:15 ` Daniel P. Berrangé

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=aMksU3AtgkuGsYcG@redhat.com \
    --to=berrange@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=gustavo.romero@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@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.