On Mon, Sep 15, 2025 at 02:42:07PM +0200, Thomas Huth wrote: > From: Gustavo Romero <gustavo.rom...@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.rom...@linaro.org> > [thuth: Rework the test to run without tests/guest-debug/run-test.py] > Signed-off-by: Thomas Huth <th...@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 :|