qemu-cr16/tests/tcg/s390x/gdbstub/test-signals-s390x.py
Peter Maydell 424dc390ec tests, scripts: Don't import print_function from __future__
Some of our Python scripts still include the line
  from __future__ import print_function

which is intended to allow a Python 2 to handle the Python 3 print()
syntax. This particular part of the future arrived many years ago,
and our minimum Python version is 3.9, so we don't need to keep
this line around.

NB: the scripts in tests/tcg/*/gdbstub/ are run with whatever Python
gdb was built against, but we can safely assume that that was a
Python 3 because our supported distros are all on Python 3.  In any
case these are only run as part of "make check-tcg", not by
end-users.

Commit created with:

 sed -i -e '/import print_function/d' $(git grep -l 'from __future__')

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20250819102409.2117969-1-peter.maydell@linaro.org
2025-09-16 17:31:53 +01:00

35 lines
905 B
Python

#
# Test that signals and debugging mix well together on s390x.
#
# This is launched via tests/guest-debug/run-test.py
#
import gdb
from test_gdbstub import main, report
def run_test():
"""Run through the tests one by one"""
illegal_op = gdb.Breakpoint("illegal_op")
stg = gdb.Breakpoint("stg")
mvc_8 = gdb.Breakpoint("mvc_8")
# Expect the following events:
# 1x illegal_op breakpoint
# 2x stg breakpoint, segv, breakpoint
# 2x mvc_8 breakpoint, segv, breakpoint
for _ in range(14):
gdb.execute("c")
report(illegal_op.hit_count == 1, "illegal_op.hit_count == 1")
report(stg.hit_count == 4, "stg.hit_count == 4")
report(mvc_8.hit_count == 4, "mvc_8.hit_count == 4")
# The test must succeed.
gdb.Breakpoint("_exit")
gdb.execute("c")
status = int(gdb.parse_and_eval("$r2"))
report(status == 0, "status == 0")
main(run_test)