tests/functional: add tuxrun kvm gdb test for s390x

As with x86_64 we now have the bits to add a KVM gdb test. A couple of
minor wrinkles need to be handled.

The first is applying an offset when loading the symbols to take into
account the relocation that happens.

The other minor wrinkle is the s390x only supports WP_WRITE watch
points so we skip the other watch point tests lest we get confusing
messages about failing to insert HW breakpoints.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-ID: <20261019192704.3220373-20-alex.bennee@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
Alex Bennée
2026-10-19 20:27:04 +01:00
parent 09961fafc5
commit e0a7139b21
4 changed files with 33 additions and 6 deletions

View File

@@ -95,11 +95,13 @@ def do_one_watch(sym, wtype, text):
def check_watches(sym_name):
"Watch a symbol for any access."
# Should hit for any read
do_one_watch(sym_name, gdb.WP_ACCESS, "awatch")
# s390 only supports write watchpoints
if "s390" not in gdb.selected_frame().architecture().name():
# Should hit for any read
do_one_watch(sym_name, gdb.WP_ACCESS, "awatch")
# Again should hit for reads
do_one_watch(sym_name, gdb.WP_READ, "rwatch")
# Again should hit for reads
do_one_watch(sym_name, gdb.WP_READ, "rwatch")
# Finally when it is written
do_one_watch(sym_name, gdb.WP_WRITE, "watch")

View File

@@ -160,6 +160,7 @@ class TuxRunBaselineTest(QemuSystemTest):
rootfs_asset,
accel=None,
dtb_asset=None,
symbol_off = None,
drive="virtio-blk-device",
console_index=0):
"""
@@ -205,6 +206,9 @@ class TuxRunBaselineTest(QemuSystemTest):
"--gdb", gdb_path,
]
if symbol_off is not None:
cmd.extend(["--symbol-offset", f"{symbol_off}"])
log_cmd = " ".join(f'"{arg}"' if ' ' in arg else arg for arg in cmd)
self.log.info(f"run-test: {log_cmd}")

View File

@@ -11,7 +11,7 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
from qemu_test import Asset
from qemu_test import Asset, skipIfMissingEnv
from qemu_test.tuxruntest import TuxRunBaselineTest
class TuxRunS390xTest(TuxRunBaselineTest):
@@ -19,6 +19,9 @@ class TuxRunS390xTest(TuxRunBaselineTest):
ASSET_S390X_KERNEL = Asset(
'https://storage.tuxboot.com/kernels/6.18.54/s390/bzImage',
'5efeb31754b211440e1595ab11355bb006fe78a2c0604ed0a8c55c4598b71aec')
ASSET_S390X_VMLINUX = Asset(
'https://storage.tuxboot.com/kernels/6.18.54/s390/vmlinux.xz',
'5bbd4d34e0950f88053a9bfd16078896df4b1ee1696fc2ad62488e681a6bdd8e')
ASSET_S390X_ROOTFS = Asset(
'https://storage.tuxboot.com/buildroot/20260924/s390/rootfs.ext4.zst',
'5ba18c4d18831c50a0c743990f7bdee1d3b520629d423c55b668d8fbbac9c6f5')
@@ -42,5 +45,18 @@ class TuxRunS390xTest(TuxRunBaselineTest):
haltmsg="Requesting system halt",
accel="kvm")
@skipIfMissingEnv("QEMU_TEST_GDB")
def test_s390_kvm_gdb(self):
self.set_machine('s390-ccw-virtio')
self.require_accelerator('kvm')
self.wait_for_shutdown=False
self.common_tuxrun_gdb(kernel_asset=self.ASSET_S390X_KERNEL,
vmlinux_asset=self.ASSET_S390X_VMLINUX,
rootfs_asset=self.ASSET_S390X_ROOTFS,
symbol_off="0x3ffe0000000",
drive="virtio-blk-ccw",
haltmsg="Requesting system halt",
accel="kvm")
if __name__ == '__main__':
TuxRunBaselineTest.main()

View File

@@ -28,6 +28,7 @@ def get_args():
parser.add_argument("--kargs", help="Kernel args to --append")
parser.add_argument("--binary", help="Binary to debug")
parser.add_argument("--symbols", help="Symbol file for binary to debug")
parser.add_argument("--symbol-offset", help="offset to apply to symbols")
parser.add_argument("--test", help="GDB test script")
parser.add_argument('test_args', nargs='*',
help="Additional args for GDB test script. "
@@ -134,7 +135,11 @@ if __name__ == '__main__':
gdb_cmd.extend(["-ex", f"target remote {socket_name}"])
if args.symbols:
gdb_cmd.extend(["-ex", f"symbol-file {args.symbols}"])
sym_arg = f"symbol-file {args.symbols}"
if args.symbol_offset:
sym_arg += f" -o {args.symbol_offset}"
gdb_cmd.extend(["-ex", sym_arg])
# finally the test script itself
if args.test: