qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/9] tests/functional: Adapt reverse_debugging to run w/o Avocado
@ 2025-10-02  2:04 Gustavo Romero
  2025-10-02  2:04 ` [PATCH v5 1/9] tests/functional: Re-activate the check-venv target Gustavo Romero
                   ` (9 more replies)
  0 siblings, 10 replies; 33+ messages in thread
From: Gustavo Romero @ 2025-10-02  2:04 UTC (permalink / raw)
  To: qemu-devel, alex.bennee, thuth, berrange; +Cc: qemu-arm, gustavo.romero

The goal of this series is to remove Avocado as a dependency for running
the reverse_debugging functional test.

After several rounds of discussions about v1 and v2, and experiments
done by Daniel and Thomas (thanks for all the experiments and comments
so far), I've taken a new approach and moved away from using a runner
for GDB. The changes, I believe, are much simpler now.

This new series uses GDB's machine interface (MI) via the pygdbmi module
(thanks Manos and Peter for the inputs). pygdbmi provides a controller
to start GDB and communicate with it through MI, so there is no longer a
risk of version clashes between libpython in GDB and Python modules in
the pyvenv, as it could, in theory, happen when GDB executes the test
script via -x option.

Also, as Daniel pointed out, the overall test output is pretty bad and
currently does not allow one to easily follow the sequence of GDB
commands used in the test. I took this opportunity to improve the output
and it now prints the sequence in a format that can be copied and pasted
directly into GDB.

The TAP protocol is respected, and Meson correctly displays GDB's test
output in testlog-thorough.txt.

Because the pygdbmi "shim" is so thin, I had to write a trivial GDB
class around it to easily capture and print the payloads returned by its
write() method. The GDB class allows clean, single-line commands to be
used in the tests through method chaining, making them easier to follow,
for example:

pc = gdb.cli("print $pc").get_add()

The test is kept “skipped” for aarch64, ppc64, and x86_64, so it is
necessary to set QEMU_TEST_FLAKY_TESTS=1 in the test environment to
effectively run the test on these archs.

On aarch64, the test is flaky, but there is a fix that I’ve tested while
writing this series [0] that resolves it. On ppc64 and x86_64, the test
always fails: on ppc64, GDB gets a bogus PC, and on x86_64, the last
part of the test (reverse-continue) does not hit the last executed PC
(as it should happen) but instead jumps to the beginning of the code
(first PC in forward order).

Thus, to effectively run the reverse_debugging test on aarch64:

$ export QEMU_TEST_FLAKY_TESTS=1
$ make check-functional

or:
$ make check-functional-aarch64

or even, to run only the reverse_debug test after 'make check-functional':
$ ./pyvenv/bin/meson test --verbose --no-rebuild -t 1 --setup thorough --suite func-thorough func-aarch64-reverse_debug


Cheers,
Gustavo

v1:
https://patchew.org/QEMU/20250819143916.4138035-1-gustavo.romero@linaro.org/

v2:
https://patchew.org/QEMU/20250904154640.52687-1-gustavo.romero@linaro.org/

v3:
https://patchew.org/QEMU/20250922054351.14289-1-gustavo.romero@linaro.org/

v4:
https://patchew.org/QEMU/20250926051542.104432-1-gustavo.romero@linaro.org/

v5:
- Fixed installation of "pygdbmi" in the test env for
  "make check-functional-<ARCH>" (thuth)
- Increased GDB command timeout from 4 to 32 seconds (thuth)
- Reverted use of get_pc() in reverse_debugging.py (thuth)
- Removed $gdb_arches from configure and checked if GDB supports the
  arch to be tested in reverse_debugging.py instead. If the arch is not
  supported by GDB the test is skipped (thuth)
- Corrected grammar in GDB timeout message (thuth)
- Skipped test if "pygdbmi" is not installed in the test environment
  (thuth, danpb)
- Improved error handling in try: block when GDB commands fail, time out,
  or when the test fails, so there is no "double exception"


Daniel P. Berrangé (2):
  tests/functional: replace avocado process with subprocess
  tests/functional: drop datadrainer class in reverse debugging

Gustavo Romero (7):
  tests/functional: Re-activate the check-venv target
  python: Install pygdbmi in meson's venv
  tests/functional: Provide GDB to the functional tests
  tests/functional: Add GDB class
  tests/functional: Add decorator to skip test on missing env vars
  tests/functional: Adapt reverse_debugging to run w/o Avocado
  tests/functional: Adapt arches to reverse_debugging w/o Avocado

 configure                                     |   2 +
 meson_options.txt                             |   2 +
 pythondeps.toml                               |   1 +
 scripts/meson-buildoptions.sh                 |   2 +
 tests/Makefile.include                        |   4 +-
 .../functional/aarch64/test_reverse_debug.py  |  11 +-
 tests/functional/meson.build                  |   6 +
 tests/functional/ppc64/test_reverse_debug.py  |  15 +-
 tests/functional/qemu_test/__init__.py        |   4 +-
 tests/functional/qemu_test/decorators.py      |  18 +++
 tests/functional/qemu_test/gdb.py             |  88 ++++++++++
 tests/functional/reverse_debugging.py         | 151 +++++++++---------
 tests/functional/x86_64/test_reverse_debug.py |  15 +-
 13 files changed, 218 insertions(+), 101 deletions(-)
 create mode 100644 tests/functional/qemu_test/gdb.py

-- 
2.34.1



^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2025-10-14 19:20 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02  2:04 [PATCH v5 0/9] tests/functional: Adapt reverse_debugging to run w/o Avocado Gustavo Romero
2025-10-02  2:04 ` [PATCH v5 1/9] tests/functional: Re-activate the check-venv target Gustavo Romero
2025-10-02 13:06   ` Daniel P. Berrangé
2025-10-02 16:08   ` Thomas Huth
2025-10-02  2:04 ` [PATCH v5 2/9] python: Install pygdbmi in meson's venv Gustavo Romero
2025-10-02 13:06   ` Daniel P. Berrangé
2025-10-14 17:39   ` John Snow
2025-10-14 18:21     ` Thomas Huth
2025-10-14 18:55       ` John Snow
2025-10-14 18:59         ` Thomas Huth
2025-10-14 19:05           ` John Snow
2025-10-14 19:19             ` Thomas Huth
2025-10-02  2:04 ` [PATCH v5 3/9] tests/functional: Provide GDB to the functional tests Gustavo Romero
2025-10-02 13:08   ` Daniel P. Berrangé
2025-10-02  2:04 ` [PATCH v5 4/9] tests/functional: Add GDB class Gustavo Romero
2025-10-02 13:11   ` Daniel P. Berrangé
2025-10-02 16:24     ` Alex Bennée
2025-10-02  2:04 ` [PATCH v5 5/9] tests/functional: replace avocado process with subprocess Gustavo Romero
2025-10-02  2:04 ` [PATCH v5 6/9] tests/functional: drop datadrainer class in reverse debugging Gustavo Romero
2025-10-02  2:04 ` [PATCH v5 7/9] tests/functional: Add decorator to skip test on missing env vars Gustavo Romero
2025-10-02 13:12   ` Daniel P. Berrangé
2025-10-02  2:04 ` [PATCH v5 8/9] tests/functional: Adapt reverse_debugging to run w/o Avocado Gustavo Romero
2025-10-02 13:13   ` Daniel P. Berrangé
2025-10-02  2:04 ` [PATCH v5 9/9] tests/functional: Adapt arches to reverse_debugging " Gustavo Romero
2025-10-02 13:14   ` Daniel P. Berrangé
2025-10-02 16:53 ` [PATCH v5 0/9] tests/functional: Adapt reverse_debugging to run " Thomas Huth
2025-10-02 17:52   ` Thomas Huth
2025-10-03 13:30     ` Gustavo Romero
2025-10-03 14:38       ` Gustavo Romero
2025-10-03 15:07         ` Gustavo Romero
2025-10-06  7:24           ` Thomas Huth
2025-10-06  9:58             ` Alex Bennée
2025-10-06 10:07               ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).