aboutsummaryrefslogtreecommitdiff
path: root/tests/guest-debug
AgeCommit message (Collapse)Author
2024-05-17tests: Gently exit from GDB when tests completeGustavo Romero
GDB commit a207f6b3a38 ('Rewrite "python" command exception handling') changed how exit() called from Python scripts loaded by GDB behave, turning it into an exception instead of a generic error code that is returned. This change caused several QEMU tests to crash with the following exception: Python Exception <class 'SystemExit'>: 0 Error occurred in Python: 0 This happens because in tests/guest-debug/test_gdbstub.py exit is called after the tests have completed. This commit fixes it by politely asking GDB to exit via gdb.execute, passing the proper fail_count to be reported to 'make', instead of abruptly calling exit() from the Python script. Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240515173132.2462201-4-gustavo.romero@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-01-29tests/tcg: Factor out gdbstub test functionsIlya Leoshkevich
Both the report() function as well as the initial gdbstub test sequence are copy-pasted into ~10 files with slight modifications. This indicates that they are indeed generic, so factor them out. While at it, add a few newlines to make the formatting closer to PEP-8. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20240129093410.3151-3-iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2023-08-30tests/tcg: clean-up gdb confirm/pagination settingsAlex Bennée
We can do this all in the run-test.py script so remove the extraneous bits from the individual tests which got copied from the original non-CI gdb tests. Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230829161528.2707696-8-alex.bennee@linaro.org>
2023-08-30tests: remove test-gdbstub.pyAlex Bennée
This isn't directly called by our CI and because it doesn't run via our run-test.py script does things slightly differently. Lets remove it as we have plenty of working in-tree tests now for various aspects of gdbstub. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230829161528.2707696-7-alex.bennee@linaro.org>
2023-08-10tests/tcg: ensure system-mode gdb tests start stoppedAlex Bennée
Without -S we run into potential races with tests starting before the gdbstub attaches. We don't need to worry about user-mode as enabling the gdbstub implies we wait for the initial connection. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20230810153640.1879717-7-alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2023-05-18gdbstub: add test for untimely stop-reply packetsMatheus Tavares Bernardino
In the previous commit, we modified gdbstub.c to only send stop-reply packets as a response to GDB commands that accept it. Now, let's add a test for this intended behavior. Running this test before the fix from the previous commit fails as QEMU sends a stop-reply packet asynchronously, when GDB was in fact waiting an ACK. Signed-off-by: Matheus Tavares Bernardino <quic_mathbern@quicinc.com> Acked-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> Message-Id: <a30d93b9a8d66e9d9294354cfa2fc3af35f00202.1683214375.git.quic_mathbern@quicinc.com>
2022-04-20tests/guest-debug: better handle gdb crashesAlex Bennée
There are a number of GDB's on various distros which fail fairly hard when attempting to talk to a cross-arch guest. The previous attempt to catch this was incorrect as the shell will deliver signals as 128+n. Fix the detection and while we are it improve the logging we dump into the test output. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reported-by: Gautam Agrawal <gautamnagrawal@gmail.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20220419091020.3008144-26-alex.bennee@linaro.org>
2021-02-25chardev: do not use short form boolean options in non-QemuOpts character ↵Paolo Bonzini
device descriptions Options such as "-gdb" or "-serial" accept a part-QemuOpts part-parsed-by-hand character device description. Do not use short form boolean options in the QemuOpts part. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-01-18gdbstub: implement a softmmu based testAlex Bennée
This adds a new tests that allows us to test softmmu only features including watchpoints. To do achieve this we need to: - add _exit: labels to the boot codes - write a memory.py test case - plumb the test case into the build system - tweak the run_test script to: - re-direct output when asked - use socket based connection for all tests - add a small pause before connection Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20210108224256.2321-6-alex.bennee@linaro.org>
2021-01-18test/guest-debug: echo QEMU command as wellAlex Bennée
This helps with debugging. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20210108224256.2321-3-alex.bennee@linaro.org>
2020-05-15tests/guest-debug: catch hanging guestsAlex Bennée
If gdb never actually connected with the guest we need to catch that and clean-up after ourselves. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200513175134.19619-2-alex.bennee@linaro.org>
2020-05-06tests/guest-debug: use the unix socket for linux-user testsAlex Bennée
Now we have support for debugging over a unix socket for linux-user lets use it in our test harness. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200430190122.4592-8-alex.bennee@linaro.org>
2020-05-06tests/tcg: better trap gdb failuresAlex Bennée
It seems older and non-multiarach aware GDBs might not fail gracefully when faced with something they don't know. For example when faced with a target XML for s390x the Ubuntu 18.04 gdb will generate an internal fault and prompt for a core dump. Work around this by invoking GDB in a more batch orientated way and then trying to filter out between test failures and gdb failures. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200430190122.4592-4-alex.bennee@linaro.org>
2020-03-17tests/guest-debug: add a simple test runnerAlex Bennée
The test runners job is to start QEMU with guest debug enabled and then spawn a gdb process running a test script that exercises the functionality it wants to test. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200316172155.971-23-alex.bennee@linaro.org>
2020-02-07drop "from __future__ import print_function"Paolo Bonzini
This is only needed for Python 2, which we do not support anymore. Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Acked-by: Alex Bennée <alex.bennee@linaro.org> Acked-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20200204160604.19883-1-pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2018-11-13tests/guest-debug: fix scoping of failcountAlex Bennée
You should declare you are using a global version of a variable before you attempt to modify it in a function. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20181109152119.9242-5-alex.bennee@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-10-26tests: Fix typos in comments and help message (found by codespell)Stefan Weil
Fix also a grammar issue. Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20180713054755.23323-1-sw@weilnetz.de> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2018-06-08python: futurize -f libfuturize.fixes.fix_print_with_importEduardo Habkost
Change all Python code to use print as a function. This is necessary for Python 3 compatibility. Done using: $ py=$( (g grep -l -E '^#!.*python';find -name '*.py' -printf '%P\n';) | \ sort -u | grep -v README.sh4) $ futurize -w -f libfuturize.fixes.fix_print_with_import $py Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Fam Zheng <famz@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Message-Id: <20180608122952.2009-2-ehabkost@redhat.com> [ehabkost: fixup tests/docker/docker.py] Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2015-12-17tests/guest-debug: introduce basic gdbstub testsAlex Bennée
The aim of these tests is to combine with an appropriate kernel image (with symbol-file vmlinux) and check it behaves as it should. Given a kernel it checks: - single step - software breakpoint - hardware breakpoint - access, read and write watchpoints On success it returns 0 to the calling process. I've not plumbed this into the "make check" logic though as we need a solution for providing non-host binaries to the tests. However the test is structured to work with pretty much any Linux kernel image as it uses the basic kernel_init code which is common across architectures. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1449599553-24713-7-git-send-email-alex.bennee@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>