testing/next: functional testing updates for gdb
v2 cover testing/next: functional testing updates for gdb
Hi,
This is the current state of my testing/next tree. There a are a few minor tweaks and fixes that I've picked up. The majority of the new code adds testing for the gdb stub when used via KVM.
As a result I spoke to Anders who handles the tuxrun images and he was able to turn on debugging symbols and provide a vmlinux alongside the bootable image. With these updates I was able to resurrect the old test script I was running by hand and then plumb it into a functional test.
So far I've done x86_64, aarch64 and s390x. I can't test ppc because our CI machines don't support nested KVM. I don't have access to any riscv kvm capable hardware.
The reason I went on the side-quest is because when working on cleaning up QEMU's internal KVM api I realised that quite a large chunk of it is not exercised by our functional tests. This would ensure that at least:
kvm_arch_update_guest_debug
kvm_arch_get_registers
kvm_arch_set_registers
is exercised and I'm less likely to break things in my re-factor ;-)
v2
- fixed up the sh4 direct call
- dropped the fw tracing test case as tuxrun images cover it all
- added aarch64 and s390x cases
- worked around s390x watchpoint issues
The following still need review:
tests/functional: add tuxrun kvm gdb test for s390x tests/functional: update s390x tuxrun images tests/functional: split s390x tuxrun into tcg and kvm run tests/functional: add tuxrun kvm gdb test for arm64 tests/functional: update arm64 tuxrun images tests/functional: teach tuxrun about launching gdb tests tests/functional: allow tuxrun tests to be passed "accel"
Alex.
Alex Bennée (15):
tests/functional: test_acpi_bits requires TCG
meson: move gdb detection into the top level build file tests/functional: allow tuxrun tests to be passed "accel" tests/functional: split x86_64 tuxrun into tcg and kvm run tests/functional: update x86_64 tuxrun images tests/guest-debug: add --kargs option to run-test tests/guest-debug: add --symbols option to run-test tests/functional: teach tuxrun about launching gdb tests tests/functional: add tuxrun kvm gdb test for x86_64 tests/functional: split aarch64 tuxrun into tcg and kvm run tests/functional: update arm64 tuxrun images tests/functional: add tuxrun kvm gdb test for arm64 tests/functional: split s390x tuxrun into tcg and kvm run tests/functional: update s390x tuxrun images tests/functional: add tuxrun kvm gdb test for s390x
Max Filippov (1):
tests/tcg: fix buffer overflow in multiarch/linux/linux-sigrtminmax
meson.build | 15 +- tests/tcg/multiarch/linux/linux-sigrtminmax.c | 2 +- tests/functional/aarch64/test_tuxrun.py | 35 +++- .../functional/gdb-scripts/kernel_gdb_test.py | 176 ++++++++++++++++++ tests/functional/meson.build | 5 +- tests/functional/qemu_test/tuxruntest.py | 103 +++++++++- tests/functional/s390x/test_tuxrun.py | 33 +++- tests/functional/sh4/test_tuxrun.py | 2 +- tests/functional/x86_64/test_acpi_bits.py | 3 + tests/functional/x86_64/test_tuxrun.py | 45 ++++- tests/guest-debug/run-test.py | 10 + tests/tcg/meson.build | 5 - 12 files changed, 391 insertions(+), 43 deletions(-) create mode 100644 tests/functional/gdb-scripts/kernel_gdb_test.py
Signature · 1 line
2.47.3
PATCH v2 1/16 tests/functional: test_acpi_bits requires TCG
Running a full thorough test suite on a KVM-only build fails due to acpi bits needing icount, therefor tcg. Declare the restriction so the test harness can skip it.
Message-ID: <[email protected]>
---
v2
- add comment
--- tests/functional/x86_64/test_acpi_bits.py | 3 +++ 1 file changed, 3 insertions(+)
tests/functional/x86_64/test_acpi_bits.py +3 -0
@@ -303,6 +303,9 @@ def test_acpi_smbios_bits(self): """The main test case implementation.""" self.set_machine('pc') + # see icount comment below + self.require_accelerator('tcg') + iso_file = self.scratch_file('bits-%d.iso' % self.BITS_INTERNAL_VER) self.assertTrue(os.access(iso_file, os.R_OK))
Signature · 1 line
2.47.3
PATCH v2 2/16 tests/tcg: fix buffer overflow in multiarch/linux/linux-sigrtminmax
In reply to Alex BennéeFrom: Max Filippov <[email protected]>
Fix new_argv allocation size to be (argc + 2) * sizeof(char *) bytes, which matches the way it's used to store argc + 2 pointers.
This fixes the test for me, which otherwise fails on xtensa with the following message
linux-sigrtminmax.c: 59: main: Assertion `execve(new_argv[0], new_argv, environ) == 0' failed.'.
Message-ID: <[email protected]>
Message-ID: <[email protected]>
--- tests/tcg/multiarch/linux/linux-sigrtminmax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/tcg/multiarch/linux/linux-sigrtminmax.c +1 -1
@@ -39,7 +39,7 @@ int main(int argc, char **argv)assert (qemu);if (!getenv ("QEMU_RTSIG_MAP" )) { -char **new_argv =malloc ((argc +2 ) +sizeof (char *)); +char **new_argv =malloc ((argc +2 ) *sizeof (char *));int tsig1, hsig1, count1, tsig2, hsig2, count2;char rt_sigmap[64 ];
Signature · 1 line
2.47.3
PATCH v2 3/16 meson: move gdb detection into the top level build file
In reply to Alex BennéeCurrently gdb is only used by TCG based tests but hypervisors want to use gdbstub too. To be able to test this case we need to always probe and report the gdb we have.
Message-ID: <[email protected]>
--- meson.build | 15 +++++++-------- tests/functional/meson.build | 5 ++--- tests/tcg/meson.build | 5 ----- 3 files changed, 9 insertions(+), 16 deletions(-)
meson.build +7 -8
@@ -163,6 +163,12 @@ else iasl = find_program(get_option('iasl'), required: true) endif +if get_option('gdb') == '' + gdb = find_program(['gdb-multiarch', 'gdb'], required: false) +else + gdb = find_program(get_option('gdb'), required: true) +endif + edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu', 'riscv64-softmmu', 'loongarch64-softmmu' ] unpack_edk2_blobs = false foreach target : edk2_targets
@@ -4720,14 +4726,7 @@ summary(summary_info, bool_yn: true, section: 'Directories') summary_info = {} summary_info += {'python': '@0@ (version: @1@)'.format(python.full_path(), python.language_version())} summary_info += {'sphinx-build': sphinx_build} - -# FIXME: the [binaries] section of machine files, which can be probed -# with find_program(), would be great for passing gdb and genisoimage -# paths from configure to Meson. However, there seems to be no way to -# hide a program (for example if gdb is too old). -if config_host.has_key('GDB') - summary_info += {'gdb': config_host['GDB']} -endif +summary_info += {'gdb': gdb} summary_info += {'iasl': iasl} summary_info += {'genisoimage': config_host['GENISOIMAGE']} if host_os == 'windows' and have_ga
tests/functional/meson.build +2 -3
@@ -83,9 +83,8 @@ foreach speed : ['quick', 'thorough'] separator : ':') # Define the GDB environment variable if gdb is available. - gdb = get_option('gdb') - if gdb != '' - test_env.set('QEMU_TEST_GDB', gdb) + if gdb.found() + test_env.set('QEMU_TEST_GDB', gdb.full_path()) endif foreach test : target_tests
tests/tcg/meson.build +0 -5
@@ -1,11 +1,6 @@ env = find_program('env') docker_wrapper = find_program('../docker/docker.py') -if get_option('gdb') != '' - gdb = find_program(get_option('gdb'), required: true) -else - gdb = find_program(['gdb-multiarch', 'gdb'], required: false) -endif prog_check_plugin_output = find_program('./scripts/check_plugin_output.sh') prog_gdb_test = find_program('../guest-debug/run-test.py') prog_record_replay = find_program('./scripts/record_replay.sh')
Signature · 1 line
2.47.3
PATCH v2 4/16 tests/functional: allow tuxrun tests to be passed "accel"
In reply to Alex BennéeFor some tests we are about to add we want the flexibility to force "kvm" so give them that ability.
Message-ID: <[email protected]>
---
v2
- fix the sh4 direct call to prepare run.
--- tests/functional/qemu_test/tuxruntest.py | 9 +++++++-- tests/functional/sh4/test_tuxrun.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-)
tests/functional/qemu_test/tuxruntest.py +7 -2
@@ -65,7 +65,7 @@ def fetch_tuxrun_assets(self, kernel_asset, rootfs_asset, dtb_asset=None): return (kernel_image, disk_image, dtb) - def prepare_run(self, kernel, disk, drive, dtb=None, console_index=0): + def prepare_run(self, accel, kernel, disk, drive, dtb=None, console_index=0): """ Setup to run and add the common parameters to the system """
@@ -79,6 +79,10 @@ def prepare_run(self, kernel, disk, drive, dtb=None, console_index=0): self.kcmd_line += f" root=/dev/{self.root}" self.kcmd_line += f" console={self.console}" + # have we specified an accelerator? + if accel: + self.vm.add_args('-accel', accel) + self.vm.add_args('-kernel', kernel, '-append', self.kcmd_line, '-blockdev', blockdev)
@@ -118,6 +122,7 @@ def run_tuxtest_tests(self, haltmsg): def common_tuxrun(self, kernel_asset, rootfs_asset, + accel=None, dtb_asset=None, drive="virtio-blk-device", haltmsg="reboot: System halted",
@@ -130,7 +135,7 @@ def common_tuxrun(self, (kernel, disk, dtb) = self.fetch_tuxrun_assets(kernel_asset, rootfs_asset, dtb_asset) - self.prepare_run(kernel, disk, drive, dtb, console_index) + self.prepare_run(accel, kernel, disk, drive, dtb, console_index) self.vm.launch() self.run_tuxtest_tests(haltmsg) os.remove(disk)
tests/functional/sh4/test_tuxrun.py +1 -1
@@ -35,7 +35,7 @@ def test_sh4(self): self.ASSET_SH4_ROOTFS) # the console comes on the second serial port - self.prepare_run(kernel, disk, + self.prepare_run(None, kernel, disk, "driver=ide-hd,bus=ide.0,unit=0", console_index=1) self.vm.launch()
Signature · 1 line
2.47.3
Re: [PATCH v2 04/16] tests/functional: allow tuxrun tests to be passed "accel"
Quoted 8 lines · Alex Bennée
For some tests we are about to add we want the flexibility to force "kvm" so give them that ability.
Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>[...]
Signature · 1 line
Marc-André Lureau <[email protected]>
Re: [PATCH v2 04/16] tests/functional: allow tuxrun tests to be passed "accel"
In reply to Alex BennéeQuoted 6 lines · Alex Bennée
For some tests we are about to add we want the flexibility to force "kvm" so give them that ability.
Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>
Quoted 7 lines
---
v2
- fix the sh4 direct call to prepare run.--- tests/functional/qemu_test/tuxruntest.py | 9 +++++++-- tests/functional/sh4/test_tuxrun.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-)
PATCH v2 5/16 tests/functional: split x86_64 tuxrun into tcg and kvm run
In reply to Alex BennéeAdd an explicit "kvm" run to the tuxrun tests. Although running on an x86_64 host would probably have defaulted to "kvm" anyway we want to exercise specific features later.
Message-ID: <[email protected]>
--- tests/functional/x86_64/test_tuxrun.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
tests/functional/x86_64/test_tuxrun.py +16 -1
@@ -24,13 +24,28 @@ class TuxRunX86Test(TuxRunBaselineTest): '4b8b2a99117519c5290e1202cb36eb6c7aaba92b357b5160f5970cf5fb78a751') def test_x86_64(self): + self.require_accelerator("tcg") + + self.set_machine('q35') + self.cpu="Nehalem" + self.root='sda' + self.wait_for_shutdown=False + self.common_tuxrun(kernel_asset=self.ASSET_X86_64_KERNEL, + rootfs_asset=self.ASSET_X86_64_ROOTFS, + drive="driver=ide-hd,bus=ide.0,unit=0", + accel="tcg") + + def test_x86_64_kvm(self): + self.require_accelerator("kvm") + self.set_machine('q35') self.cpu="Nehalem" self.root='sda' self.wait_for_shutdown=False self.common_tuxrun(kernel_asset=self.ASSET_X86_64_KERNEL, rootfs_asset=self.ASSET_X86_64_ROOTFS, - drive="driver=ide-hd,bus=ide.0,unit=0") + drive="driver=ide-hd,bus=ide.0,unit=0", + accel="kvm") if __name__ == '__main__': TuxRunBaselineTest.main()
Signature · 1 line
2.47.3
PATCH v2 6/16 tests/functional: update x86_64 tuxrun images
In reply to Alex BennéeWe now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
Message-ID: <[email protected]>
--- tests/functional/x86_64/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/x86_64/test_tuxrun.py +4 -4
@@ -17,11 +17,11 @@ class TuxRunX86Test(TuxRunBaselineTest): ASSET_X86_64_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/bzImage', - 'f57bfc6553bcd6e0a54aab86095bf642b33b5571d14e3af1731b18c87ed5aef8') + 'https://storage.tuxboot.com/kernels/6.18.54/x86_64/bzImage', + '24a3ade610c2cc426ff821050de8a35930b0371357d94cc2c334abac6658552b') ASSET_X86_64_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/rootfs.ext4.zst', - '4b8b2a99117519c5290e1202cb36eb6c7aaba92b357b5160f5970cf5fb78a751') + 'https://storage.tuxboot.com/buildroot/20260924/x86_64/rootfs.ext4.zst', + '8e310455b0244414ccff29c507f7ccfd4032e3587cc405e49ab0322738e3e27c') def test_x86_64(self): self.require_accelerator("tcg")
Signature · 1 line
2.47.3
Re: [PATCH v2 06/16] tests/functional: update x86_64 tuxrun images
Quoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
This commit message appears unrelated to the patch content or subject line.
Quoted 31 lines
Reviewed-by Marc-André Lureau <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/x86_64/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)tests/functional/x86_64/test_tuxrun.py +4
-4@@ -17,11 +17,11 @@ class TuxRunX86Test(TuxRunBaselineTest): ASSET_X86_64_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/bzImage', - 'f57bfc6553bcd6e0a54aab86095bf642b33b5571d14e3af1731b18c87ed5aef8') + 'https://storage.tuxboot.com/kernels/6.18.54/x86_64/bzImage', + '24a3ade610c2cc426ff821050de8a35930b0371357d94cc2c334abac6658552b') ASSET_X86_64_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/rootfs.ext4.zst', - '4b8b2a99117519c5290e1202cb36eb6c7aaba92b357b5160f5970cf5fb78a751') + 'https://storage.tuxboot.com/buildroot/20260924/x86_64/rootfs.ext4.zst', + '8e310455b0244414ccff29c507f7ccfd4032e3587cc405e49ab0322738e3e27c') def test_x86_64(self): self.require_accelerator("tcg")Signature · 1 line
2.47.3
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Re: [PATCH v2 06/16] tests/functional: update x86_64 tuxrun images
Quoted 7 lines · Daniel P. Berrangé
Quoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
This commit message appears unrelated to the patch content or subject line.
The kernel is now coming from: https://storage.tuxboot.com/kernels/6.18.54/
instead of part of the buildroot build in https://storage.tuxboot.com/buildroot/20260924/x86_64/
Quoted 35 lines
Quoted 32 lines
Reviewed-by Marc-André Lureau <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/x86_64/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)tests/functional/x86_64/test_tuxrun.py +4
-4@@ -17,11 +17,11 @@ class TuxRunX86Test(TuxRunBaselineTest): ASSET_X86_64_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/bzImage', - 'f57bfc6553bcd6e0a54aab86095bf642b33b5571d14e3af1731b18c87ed5aef8') + 'https://storage.tuxboot.com/kernels/6.18.54/x86_64/bzImage', + '24a3ade610c2cc426ff821050de8a35930b0371357d94cc2c334abac6658552b') ASSET_X86_64_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/rootfs.ext4.zst', - '4b8b2a99117519c5290e1202cb36eb6c7aaba92b357b5160f5970cf5fb78a751') + 'https://storage.tuxboot.com/buildroot/20260924/x86_64/rootfs.ext4.zst', + '8e310455b0244414ccff29c507f7ccfd4032e3587cc405e49ab0322738e3e27c') def test_x86_64(self): self.require_accelerator("tcg")Signature · 1 line
2.47.3With regards,
Daniel
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Re: [PATCH v2 06/16] tests/functional: update x86_64 tuxrun images
Quoted 7 lines · Alex Bennée
Quoted 5 lines · Daniel P. Berrangé
Quoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
Quoted 5 lines
Quoted 2 lines
This commit message appears unrelated to the patch content or subject line.
The kernel is now coming from: https://storage.tuxboot.com/kernels/6.18.54/
instead of part of the buildroot build in https://storage.tuxboot.com/buildroot/20260924/x86_64/
Ah ok, I misunderstood what the commit message was trying to say, though I'm still underclear how the before/after bzImage differ from each other ?
Is the https://storage.tuxboot.com/kernels/6.18.54/ the authoritative input for the process that produces
https://storage.tuxboot.com/buildroot/20260924/x86_64/ ?
I see the later patch is pulling in vmlinuz.xz from the former location, so I guess you're trying to just use the common location for both kernel images ?
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Reviewed-by Marc-André Lureau <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/x86_64/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)tests/functional/x86_64/test_tuxrun.py +4
-4@@ -17,11 +17,11 @@ class TuxRunX86Test(TuxRunBaselineTest): ASSET_X86_64_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/bzImage', - 'f57bfc6553bcd6e0a54aab86095bf642b33b5571d14e3af1731b18c87ed5aef8') + 'https://storage.tuxboot.com/kernels/6.18.54/x86_64/bzImage', + '24a3ade610c2cc426ff821050de8a35930b0371357d94cc2c334abac6658552b') ASSET_X86_64_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/rootfs.ext4.zst', - '4b8b2a99117519c5290e1202cb36eb6c7aaba92b357b5160f5970cf5fb78a751') + 'https://storage.tuxboot.com/buildroot/20260924/x86_64/rootfs.ext4.zst', + '8e310455b0244414ccff29c507f7ccfd4032e3587cc405e49ab0322738e3e27c')
Quoted 13 lines
Quoted 8 lines
Quoted 5 lines
tests/functional/x86_64/test_tuxrun.py +0
-0def test_x86_64(self): self.require_accelerator("tcg")Signature · 1 line
2.47.3With regards,
DanielSignature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Re: [PATCH v2 06/16] tests/functional: update x86_64 tuxrun images
Quoted 14 lines · Daniel P. Berrangé
Quoted 7 lines · Alex Bennée
Quoted 5 lines · Daniel P. Berrangé
Quoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
Quoted 5 lines
Quoted 2 lines
This commit message appears unrelated to the patch content or subject line.
The kernel is now coming from: https://storage.tuxboot.com/kernels/6.18.54/
instead of part of the buildroot build in https://storage.tuxboot.com/buildroot/20260924/x86_64/
Quoted 7 lines
Ah ok, I misunderstood what the commit message was trying to say, though I'm still underclear how the before/after bzImage differ from each other ?
Is the https://storage.tuxboot.com/kernels/6.18.54/ the authoritative input for the process that produces
https://storage.tuxboot.com/buildroot/20260924/x86_64/ ?
No - they are different builds, but the kernel builds have had the symbol generation turned on and the buildroot images are generic anyway which is why they still work together.
Quoted 49 lines
I see the later patch is pulling in vmlinuz.xz from the former location, so I guess you're trying to just use the common location for both kernel images ?
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Reviewed-by Marc-André Lureau <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/x86_64/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)tests/functional/x86_64/test_tuxrun.py +4
-4@@ -17,11 +17,11 @@ class TuxRunX86Test(TuxRunBaselineTest): ASSET_X86_64_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/bzImage', - 'f57bfc6553bcd6e0a54aab86095bf642b33b5571d14e3af1731b18c87ed5aef8') + 'https://storage.tuxboot.com/kernels/6.18.54/x86_64/bzImage', + '24a3ade610c2cc426ff821050de8a35930b0371357d94cc2c334abac6658552b') ASSET_X86_64_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/rootfs.ext4.zst', - '4b8b2a99117519c5290e1202cb36eb6c7aaba92b357b5160f5970cf5fb78a751') + 'https://storage.tuxboot.com/buildroot/20260924/x86_64/rootfs.ext4.zst', + '8e310455b0244414ccff29c507f7ccfd4032e3587cc405e49ab0322738e3e27c')Quoted 13 lines
Quoted 8 lines
Quoted 5 lines
tests/functional/x86_64/test_tuxrun.py +0
-0def test_x86_64(self): self.require_accelerator("tcg")Signature · 1 line
2.47.3With regards,
DanielSignature · 2 lines
Alex Bennée Virtualisation Tech Lead @ LinaroWith regards,
Daniel
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Re: [PATCH v2 06/16] tests/functional: update x86_64 tuxrun images
Quoted 20 lines · Alex Bennée
Quoted 18 lines · Daniel P. Berrangé
Quoted 7 lines · Alex Bennée
Quoted 5 lines · Daniel P. Berrangé
Quoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
Quoted 5 lines
Quoted 2 lines
This commit message appears unrelated to the patch content or subject line.
The kernel is now coming from: https://storage.tuxboot.com/kernels/6.18.54/
instead of part of the buildroot build in https://storage.tuxboot.com/buildroot/20260924/x86_64/Ah ok, I misunderstood what the commit message was trying to say, though I'm still underclear how the before/after bzImage differ from each other ?
Quoted 7 lines
Quoted 3 lines
Is the https://storage.tuxboot.com/kernels/6.18.54/ the authoritative input for the process that produces
https://storage.tuxboot.com/buildroot/20260924/x86_64/ ?No - they are different builds, but the kernel builds have had the symbol generation turned on and the buildroot images are generic anyway which is why they still work together.
Ok, anyway, no objection to the patch. Just expand on the commit message little in any way you feel is useful. No need for me to re-review it.
Quoted 43 lines
Quoted 43 lines
I see the later patch is pulling in vmlinuz.xz from the former location, so I guess you're trying to just use the common location for both kernel images ?
Quoted 37 lines
Quoted 36 lines
Quoted 33 lines
Reviewed-by Marc-André Lureau <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/x86_64/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)tests/functional/x86_64/test_tuxrun.py +4
-4@@ -17,11 +17,11 @@ class TuxRunX86Test(TuxRunBaselineTest): ASSET_X86_64_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/bzImage', - 'f57bfc6553bcd6e0a54aab86095bf642b33b5571d14e3af1731b18c87ed5aef8') + 'https://storage.tuxboot.com/kernels/6.18.54/x86_64/bzImage', + '24a3ade610c2cc426ff821050de8a35930b0371357d94cc2c334abac6658552b') ASSET_X86_64_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/x86_64/rootfs.ext4.zst', - '4b8b2a99117519c5290e1202cb36eb6c7aaba92b357b5160f5970cf5fb78a751') + 'https://storage.tuxboot.com/buildroot/20260924/x86_64/rootfs.ext4.zst', + '8e310455b0244414ccff29c507f7ccfd4032e3587cc405e49ab0322738e3e27c') def test_x86_64(self): self.require_accelerator("tcg")Signature · 1 line
2.47.3With regards,
Daniel
Quoted 12 lines
Quoted 7 lines
Quoted 4 lines
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ LinaroWith regards,
DanielSignature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
PATCH v2 7/16 tests/guest-debug: add --kargs option to run-test
In reply to Alex BennéeWhen passing kernel arguments to QEMU with --append we need to take care that things are properly escaped. It's easier if we get the run script to do it for us that constructed the nested escaped --qargs.
Message-ID: <[email protected]>
--- tests/guest-debug/run-test.py | 5 +++++ 1 file changed, 5 insertions(+)
tests/guest-debug/run-test.py +5 -0
@@ -25,6 +25,7 @@ def get_args(): required=True) parser.add_argument("--qargs", help="Qemu arguments for test") parser.add_argument("--pargs", help="Program arguments for test") + parser.add_argument("--kargs", help="Kernel args to --append") parser.add_argument("--binary", help="Binary to debug", required=True) parser.add_argument("--test", help="GDB test script")
@@ -82,6 +83,8 @@ def log(output, msg): suspend = ' -S' cmd = f'{args.qemu} {args.qargs} {args.binary}' \ f'{suspend} -gdb unix:path={socket_name},server=on' + if args.kargs: + cmd += f" --append '{args.kargs}'" # There is no guest program command-line in system mode. assert not args.pargs else:
@@ -93,6 +96,8 @@ def log(output, msg): f' {args.binary}' if args.pargs: cmd += f' {args.pargs}' + # There are no appended args in user-mode + assert not args.kargs log(output, "QEMU CMD: %s" % (cmd)) inferior = subprocess.Popen(shlex.split(cmd))
Signature · 1 line
2.47.3
Re: [PATCH v2 07/16] tests/guest-debug: add --kargs option to run-test
Quoted 24 lines · Alex Bennée
When passing kernel arguments to QEMU with --append we need to take care that things are properly escaped. It's easier if we get the run script to do it for us that constructed the nested escaped --qargs.
Reviewed-by Marc-André Lureau <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- tests/guest-debug/run-test.py | 5 +++++ 1 file changed, 5 insertions(+)tests/guest-debug/run-test.py +1
-0@@ -25,6 +25,7 @@ def get_args(): required=True) parser.add_argument("--qargs", help="Qemu arguments for test") parser.add_argument("--pargs", help="Program arguments for test") + parser.add_argument("--kargs", help="Kernel args to --append") parser.add_argument("--binary", help="Binary to debug", required=True) parser.add_argument("--test", help="GDB test script")
tests/guest-debug/run-test.py def log(output, msg): · line 87
Quoted 5 lines
tests/guest-debug/run-test.py +2
-0@@ -82,6 +83,8 @@ def log(output, msg): suspend = ' -S' cmd = f'{args.qemu} {args.qargs} {args.binary}' \ f'{suspend} -gdb unix:path={socket_name},server=on' + if args.kargs: + cmd += f" --append '{args.kargs}'"
Wouldn't it be better to use shlex.quote()?
It would handle kargs containing single quotes correctly.
PATCH v2 8/16 tests/guest-debug: add --symbols option to run-test
In reply to Alex BennéeSometimes the debug symbols are not in the kernel binary image but in a separate elf blob. Provide --symbols to facilitate using them.
Message-ID: <[email protected]>
--- tests/guest-debug/run-test.py | 5 +++++ 1 file changed, 5 insertions(+)
tests/guest-debug/run-test.py +5 -0
@@ -28,6 +28,7 @@ def get_args(): parser.add_argument("--kargs", help="Kernel args to --append") parser.add_argument("--binary", help="Binary to debug", required=True) + parser.add_argument("--symbols", help="Symbol file for binary to debug") parser.add_argument("--test", help="GDB test script") parser.add_argument('test_args', nargs='*', help="Additional args for GDB test script. "
@@ -114,6 +115,10 @@ def log(output, msg): gdb_cmd += " -ex 'set confirm off'" # connect to remote gdb_cmd += " -ex 'target remote %s'" % (socket_name) + + if args.symbols: + gdb_cmd += " -ex 'symbol-file %s'" % args.symbols + # finally the test script itself if args.test: if args.test_args:
Signature · 1 line
2.47.3
Re: [PATCH v2 08/16] tests/guest-debug: add --symbols option to run-test
Quoted 23 lines · Alex Bennée
Sometimes the debug symbols are not in the kernel binary image but in a separate elf blob. Provide --symbols to facilitate using them.
Reviewed-by Marc-André Lureau <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- tests/guest-debug/run-test.py | 5 +++++ 1 file changed, 5 insertions(+)tests/guest-debug/run-test.py +1
-0@@ -28,6 +28,7 @@ def get_args(): parser.add_argument("--kargs", help="Kernel args to --append") parser.add_argument("--binary", help="Binary to debug", required=True) + parser.add_argument("--symbols", help="Symbol file for binary to debug") parser.add_argument("--test", help="GDB test script") parser.add_argument('test_args', nargs='*', help="Additional args for GDB test script. "
tests/guest-debug/run-test.py def log(output, msg): · line 121
Quoted 7 lines
tests/guest-debug/run-test.py +4
-0@@ -114,6 +115,10 @@ def log(output, msg): gdb_cmd += " -ex 'set confirm off'" # connect to remote gdb_cmd += " -ex 'target remote %s'" % (socket_name) + + if args.symbols: + gdb_cmd += " -ex 'symbol-file %s'" % args.symbols +
I would consider shlex.quote() here too. Or maybe make gdb_cmd an array and use subprocess.call(shell=False)?
Also, while it's probably a matter of existing code style and personal preferences, I would use an f-string instead of %.
Quoted 3 lines
tests/guest-debug/run-test.py +0
-0# finally the test script itself if args.test: if args.test_args:
Re: [PATCH v2 08/16] tests/guest-debug: add --symbols option to run-test
Quoted 25 lines · Ilya Leoshkevich
Quoted 24 lines · Alex Bennée
Sometimes the debug symbols are not in the kernel binary image but in a separate elf blob. Provide --symbols to facilitate using them.
Reviewed-by Marc-André Lureau <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>--- tests/guest-debug/run-test.py | 5 +++++ 1 file changed, 5 insertions(+)tests/guest-debug/run-test.py +1
-0@@ -28,6 +28,7 @@ def get_args(): parser.add_argument("--kargs", help="Kernel args to --append") parser.add_argument("--binary", help="Binary to debug", required=True) + parser.add_argument("--symbols", help="Symbol file for binary to debug") parser.add_argument("--test", help="GDB test script") parser.add_argument('test_args', nargs='*', help="Additional args for GDB test script. "@@ -114,6 +115,10 @@ def log(output, msg): gdb_cmd += " -ex 'set confirm off'" # connect to remote
Quoted 8 lines
tests/guest-debug/run-test.py def log(output, msg): · line 121
Quoted 5 lines
tests/guest-debug/run-test.py +4
-0gdb_cmd += " -ex 'target remote %s'" % (socket_name) + + if args.symbols: + gdb_cmd += " -ex 'symbol-file %s'" % args.symbols +I would consider
shlex.quote()here too. Or maybe makegdb_cmdan array and usesubprocess.call(shell=False)?
I have made it an array in the new version.
Quoted 7 lines
Also, while it's probably a matter of existing code style and personal preferences, I would use an f-string instead of %.
Quoted 3 lines
tests/guest-debug/run-test.py +0
-0# finally the test script itself if args.test: if args.test_args:
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v2 9/16 tests/functional: teach tuxrun about launching gdb tests
In reply to Alex BennéeThis resurrects the hand run test script from d84842be6c5 (tests:
remove test-gdbstub.py) and modernises it to use the shared test infrastructure for run-test.
We then tweak the common tuxrun code to over an alternative "launch via gdbstub" helper which reuses the existing code but:
- needs a vmlinux with symbols
- extend qargs with stuff normally added by vm.launch
- passes kargs directly
- runs with the gdb run-test script
- log the run-test output to the console log
Message-ID: <[email protected]>
---
v2
- add self.vm._machine to qargs
- drop leading spaces in print () calls
- add register read tests
- use gdb.Breakpoint for hwbreak as for swbreak
- drop flaky symbol evaluation, verify hit_count instead
- explicit gdb.BP_BREAKPOINT for CatchBreakpoint
--- .../functional/gdb-scripts/kernel_gdb_test.py | 174 ++++++++++++++++++ tests/functional/qemu_test/tuxruntest.py | 96 +++++++++- 2 files changed, 261 insertions(+), 9 deletions(-) create mode 100644 tests/functional/gdb-scripts/kernel_gdb_test.py
tests/functional/gdb-scripts/kernel_gdb_test.py new file +174 -0
@@ -0,0 +1,174 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Generic Kernel GDB script to verify functionality: +# - Single-stepping +# - Hardware breakpoints +# - Software breakpoints +# - Watchpoints +# +# It relies on fairly common kernel points to break at and symbols for +# the kernel. Address space randomisation (kaslr) needs to be disabled. +# +# Copyright (c) 2026 Linaro Limited +# +# Author: +# Alex Bennée <[email protected]> +# +# This is launched by the tuxrun functional tests via tests/guest-debug/run-test.py + +import gdb +from test_gdbstub import main, report + +failcount = 0 + +def parse_registers(): + """Parse 'info registers' into a name -> value dictionary.""" + regs = {} + for line in gdb.execute("info registers", to_string=True).splitlines(): + parts = line.split() + if len(parts) >= 2: + regs[parts[0]] = parts[1] + return regs + + +def check_step(): + "Step an instruction, check it moved." + start_pc = gdb.parse_and_eval('$pc') + gdb.execute("si") + end_pc = gdb.parse_and_eval('$pc') + + return not (start_pc == end_pc) + + +def check_reg_updates(regs_start): + regs_end = parse_registers() + + changed = [k for k in regs_start + if k in regs_end and regs_start[k] != regs_end[k]] + + report(len(changed) > 0, f"{len(changed)} registers changed.") + + +def check_break(sym_name): + "Setup breakpoint, continue and check we stopped." + bp = gdb.Breakpoint(sym_name) + gdb.execute("c") + res = bp.hit_count == 1 + bp.delete() + + return res + + +# We need to do hbreak manually as the python interface doesn't export it +def check_hbreak(sym_name): + "Setup hardware breakpoint, continue and check we stopped." + bp = gdb.Breakpoint(sym_name, type = gdb.BP_HARDWARE_BREAKPOINT) + gdb.execute("c") + res = bp.hit_count == 1 + bp.delete() + + return res + + +class WatchPoint(gdb.Breakpoint): + + def get_wpstr(self, sym_name): + "Setup sym and wp_str for given symbol." + self.sym, ok = gdb.lookup_symbol(sym_name) + wp_addr = gdb.parse_and_eval(sym_name).address + self.wp_str = '*(%(type)s)(&%(address)s)' % dict( + type = wp_addr.type, address = sym_name) + + return(self.wp_str) + + def __init__(self, sym_name, type): + wp_str = self.get_wpstr(sym_name) + super(WatchPoint, self).__init__(wp_str, gdb.BP_WATCHPOINT, type) + + def stop(self): + end_pc = gdb.parse_and_eval('$pc') + print("HIT WP @ %s" % (end_pc)) + return True + + +def do_one_watch(sym, wtype, text): + + wp = WatchPoint(sym, wtype) + gdb.execute("c") + report_str = "%s for %s (%s)" % (text, sym, wp.sym.value()) + + if wp.hit_count > 0: + report(True, report_str) + wp.delete() + else: + report(False, report_str) + + +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") + + # 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") + + +class CatchBreakpoint(gdb.Breakpoint): + def __init__(self, sym_name): + super(CatchBreakpoint, self).__init__(sym_name, type = gdb.BP_BREAKPOINT) + self.sym, ok = gdb.lookup_symbol(sym_name) + + def stop(self): + end_pc = gdb.parse_and_eval('$pc') + print("CB: %s == %s" % (end_pc, self.sym.value())) + if end_pc == self.sym.value(): + report(False, "Hit final catchpoint") + + +def run_test(): + "Run through the tests one by one" + + # get the initial register state + regs_start = parse_registers() + + print("Checking we can step the first few instructions") + step_ok = 0 + for i in range(3): + if check_step(): + step_ok += 1 + + report(step_ok == 3, "single step in boot code") + + # check some registers changed + print("Checking register access works") + check_reg_updates(regs_start) + + print("Checking HW breakpoint works") + break_ok = check_hbreak("kernel_init") + report(break_ok, "hbreak @ kernel_init") + + # Can't set this up until we are in the kernel proper + # if we make it to run_init_process we've over-run and + # one of the tests failed + + print("Setup catch-all for run_init_process") + cbp = CatchBreakpoint("run_init_process") + + # We should see wait_for_completion called right at the start of + # kernel_init + print("Checking Normal breakpoint works") + break_ok = check_break("wait_for_completion") + report(break_ok, "break @ wait_for_completion") + + print("Checking watchpoint works") + check_watches("system_state") + + # check we didn't hit the end + report(cbp.hit_count == 0, "CatchBreakpoint not hit") + + +main(run_test)
tests/functional/qemu_test/tuxruntest.py +87 -9
137 lines not on this page · raw message
Signature · 1 line
2.47.3
Re: [PATCH v2 09/16] tests/functional: teach tuxrun about launching gdb tests
Quoted 36 lines
This resurrects the hand run test script from
d84842be6c5(tests:
removetest-gdbstub.py) and modernises it to use the shared test infrastructure for run-test.We then tweak the common tuxrun code to over an alternative "launch via gdbstub" helper which reuses the existing code but:
- needs a vmlinux with symbols
- extend qargs with stuff normally added by vm.launch
- passes kargs directly
- runs with the gdb run-test script
- log the run-test output to the console logMessage-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>Message-ID: <[email protected]>
tests/functional/gdb-scripts/kernel_gdb_test.py new file +12
-0@@ -0,0 +1,174 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Generic Kernel GDB script to verify functionality: +# - Single-stepping +# - Hardware breakpoints +# - Software breakpoints +# - Watchpoints +# +# It relies on fairly common kernel points to break at and symbols for +# the kernel. Address space randomisation (kaslr) needs to be disabled. +# +# Copyright (c) 2026 Linaro Limited
tests/functional/gdb-scripts/kernel_gdb_test.py line 22
Quoted 10 lines
tests/functional/gdb-scripts/kernel_gdb_test.py new file +10
-0+# +# Author: +# Alex Bennée <[email protected]> +# +# This is launched by the tuxrun functional tests via tests/guest-debug/run-test.py + +import gdb +from test_gdbstub import main, report + +failcount = 0
unused variable
Quoted 30 lines
tests/functional/gdb-scripts/kernel_gdb_test.py new file +30
-0+ +def parse_registers(): + """Parse 'info registers' into a name -> value dictionary.""" + regs = {} + for line in gdb.execute("info registers", to_string=True).splitlines(): + parts = line.split() + if len(parts) >= 2: + regs[parts[0]] = parts[1] + return regs + + +def check_step(): + "Step an instruction, check it moved." + start_pc = gdb.parse_and_eval('$pc') + gdb.execute("si") + end_pc = gdb.parse_and_eval('$pc') + + return not (start_pc == end_pc) + + +def check_reg_updates(regs_start): + regs_end = parse_registers() + + changed = [k for k in regs_start + if k in regs_end and regs_start[k] != regs_end[k]] + + report(len(changed) > 0, f"{len(changed)} registers changed.") + + +def check_break(sym_name):
tests/functional/gdb-scripts/kernel_gdb_test.py line 62
Quoted 10 lines
tests/functional/gdb-scripts/kernel_gdb_test.py new file +10
-0+ "Setup breakpoint, continue and check we stopped." + bp = gdb.Breakpoint(sym_name) + gdb.execute("c") + res = bp.hit_count == 1 + bp.delete() + + return res + + +# We need to do hbreak manually as the python interface doesn't export it
comment is now stale
Quoted 32 lines
tests/functional/gdb-scripts/kernel_gdb_test.py new file +32
-0+def check_hbreak(sym_name): + "Setup hardware breakpoint, continue and check we stopped." + bp = gdb.Breakpoint(sym_name, type = gdb.BP_HARDWARE_BREAKPOINT) + gdb.execute("c") + res = bp.hit_count == 1 + bp.delete() + + return res + + +class WatchPoint(gdb.Breakpoint): + + def get_wpstr(self, sym_name): + "Setup sym and wp_str for given symbol." + self.sym, ok = gdb.lookup_symbol(sym_name) + wp_addr = gdb.parse_and_eval(sym_name).address + self.wp_str = '*(%(type)s)(&%(address)s)' % dict( + type = wp_addr.type, address = sym_name) + + return(self.wp_str) + + def __init__(self, sym_name, type): + wp_str = self.get_wpstr(sym_name) + super(WatchPoint, self).__init__(wp_str, gdb.BP_WATCHPOINT, type) + + def stop(self): + end_pc = gdb.parse_and_eval('$pc') + print("HIT WP @ %s" % (end_pc)) + return True + + +def do_one_watch(sym, wtype, text):
tests/functional/gdb-scripts/kernel_gdb_test.py line 104
Quoted 10 lines
tests/functional/gdb-scripts/kernel_gdb_test.py new file +10
-0+ + wp = WatchPoint(sym, wtype) + gdb.execute("c") + report_str = "%s for %s (%s)" % (text, sym, wp.sym.value()) + + if wp.hit_count > 0: + report(True, report_str) + wp.delete() + else: + report(False, report_str)
Add wp.delete() in the else branch too?
Quoted 85 lines
tests/functional/gdb-scripts/kernel_gdb_test.py new file +70
-0+ + +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") + + # 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") + + +class CatchBreakpoint(gdb.Breakpoint): + def __init__(self, sym_name): + super(CatchBreakpoint, self).__init__(sym_name, type = gdb.BP_BREAKPOINT) + self.sym, ok = gdb.lookup_symbol(sym_name) + + def stop(self): + end_pc = gdb.parse_and_eval('$pc') + print("CB: %s == %s" % (end_pc, self.sym.value())) + if end_pc == self.sym.value(): + report(False, "Hit final catchpoint") + + +def run_test(): + "Run through the tests one by one" + + # get the initial register state + regs_start = parse_registers() + + print("Checking we can step the first few instructions") + step_ok = 0 + for i in range(3): + if check_step(): + step_ok += 1 + + report(step_ok == 3, "single step in boot code") + + # check some registers changed + print("Checking register access works") + check_reg_updates(regs_start) + + print("Checking HW breakpoint works") + break_ok = check_hbreak("kernel_init") + report(break_ok, "hbreak @ kernel_init") + + # Can't set this up until we are in the kernel proper + # if we make it to run_init_process we've over-run and + # one of the tests failed + + print("Setup catch-all for run_init_process") + cbp = CatchBreakpoint("run_init_process") + + # We should see wait_for_completion called right at the start of + # kernel_init + print("Checking Normal breakpoint works") + break_ok = check_break("wait_for_completion") + report(break_ok, "break @ wait_for_completion") + + print("Checking watchpoint works") + check_watches("system_state") + + # check we didn't hit the end + report(cbp.hit_count == 0, "CatchBreakpoint not hit") + + +main(run_test)tests/functional/qemu_test/tuxruntest.py +2
-0@@ -9,7 +9,9 @@ # # SPDX-License-Identifier: GPL-2.0-or-later +import logging import os +import subprocess from qemu_test import QemuSystemTest from qemu_test import exec_command_and_wait_for_pattern
tests/functional/qemu_test/tuxruntest.py line 23
Quoted 5 lines
tests/functional/qemu_test/tuxruntest.py +1
-1@@ -18,7 +20,7 @@ class TuxRunBaselineTest(QemuSystemTest): - KERNEL_COMMON_COMMAND_LINE = 'printk.time=0' + KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 nokaslr'
This was flagged in the v1 review: nokaslr is only needed for the gdb tests (the kernel_gdb_test.py header says "Address space randomisation (kaslr) needs to be disabled") but it is added globally here, affecting all tuxrun tests. Mention it in the commit message or scope it to gdb tests only?
Signature · 1 line
Marc-André Lureau <[email protected]>
Re: [PATCH v2 09/16] tests/functional: teach tuxrun about launching gdb tests
In reply to Alex BennéeQuoted 29 lines · Alex Bennée
This resurrects the hand run test script from
d84842be6c5(tests:
removetest-gdbstub.py) and modernises it to use the shared test infrastructure for run-test.We then tweak the common tuxrun code to over an alternative "launch via gdbstub" helper which reuses the existing code but:
- needs a vmlinux with symbols
- extend qargs with stuff normally added by vm.launch
- passes kargs directly
- runs with the gdb run-test script
- log the run-test output to the console logMessage-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>---
v2
- add self.vm._machine to qargs
- drop leading spaces in print () calls
- add register read tests
- use gdb.Breakpoint for hwbreak as for swbreak
- drop flaky symbol evaluation, verifyhit_countinstead
- explicit gdb.BP_BREAKPOINT for CatchBreakpoint--- .../functional/gdb-scripts/kernel_gdb_test.py | 174 ++++++++++++++++++ tests/functional/qemu_test/tuxruntest.py | 96 +++++++++- 2 files changed, 261 insertions(+), 9 deletions(-)create mode 100644
tests/functional/gdb-scripts/kernel_gdb_test.py
[...]
tests/functional/qemu_test/tuxruntest.py def wait_for_console_pattern(self, success_message, vm=None): · line 70
Quoted 13 lines
tests/functional/qemu_test/tuxruntest.py +4
-2- def fetch_tuxrun_assets(self, kernel_asset, rootfs_asset, dtb_asset=None): + def fetch_tuxrun_assets(self, kernel_asset, rootfs_asset, + dtb_asset=None, vmlinux_asset=None): """ Fetch the TuxBoot assets. """ kernel_image = kernel_asset.fetch() disk_image = self.uncompress(rootfs_asset) dtb = dtb_asset.fetch() if dtb_asset is not None else None + vmlinux = self.uncompress(vmlinux_asset) if vmlinux_asset is not None else None - return (kernel_image, disk_image, dtb) + return (kernel_image, disk_image, dtb, vmlinux)
pylint complains that unpacking in tests/functional/sh4/test_tuxrun.py will now fail.
[...]
PATCH v2 10/16 tests/functional: add tuxrun kvm gdb test for x86_64
In reply to Alex BennéeWith all the bits in place we can now exercise the KVM gdb interfaces.
Message-ID: <[email protected]>
--- tests/functional/x86_64/test_tuxrun.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
tests/functional/x86_64/test_tuxrun.py +19 -1
@@ -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 TuxRunX86Test(TuxRunBaselineTest):
@@ -19,6 +19,9 @@ class TuxRunX86Test(TuxRunBaselineTest): ASSET_X86_64_KERNEL = Asset( 'https://storage.tuxboot.com/kernels/6.18.54/x86_64/bzImage', '24a3ade610c2cc426ff821050de8a35930b0371357d94cc2c334abac6658552b') + ASSET_X86_64_VMLINUX = Asset( + 'https://storage.tuxboot.com/kernels/6.18.54/x86_64/vmlinux.xz', + '77bf44cca48c9c1b9c142e16a2311d58b8ae3462b61bce44bcaf9243b5f26628') ASSET_X86_64_ROOTFS = Asset( 'https://storage.tuxboot.com/buildroot/20260924/x86_64/rootfs.ext4.zst', '8e310455b0244414ccff29c507f7ccfd4032e3587cc405e49ab0322738e3e27c')
@@ -47,5 +50,20 @@ def test_x86_64_kvm(self): drive="driver=ide-hd,bus=ide.0,unit=0", accel="kvm") + @skipIfMissingEnv("QEMU_TEST_GDB") + def test_x86_64_kvm_gdb(self): + self.require_accelerator("kvm") + + self.set_machine('q35') + self.cpu="Nehalem" + self.root='sda' + self.wait_for_shutdown=False + self.common_tuxrun_gdb(kernel_asset=self.ASSET_X86_64_KERNEL, + vmlinux_asset=self.ASSET_X86_64_VMLINUX, + rootfs_asset=self.ASSET_X86_64_ROOTFS, + drive="driver=ide-hd,bus=ide.0,unit=0", + accel="kvm") + + if __name__ == '__main__': TuxRunBaselineTest.main()
Signature · 1 line
2.47.3
PATCH v2 11/16 tests/functional: split aarch64 tuxrun into tcg and kvm run
In reply to Alex BennéeAdd an explicit "kvm" run to the tuxrun tests. Although running on an aarch64 host would probably have defaulted to "kvm" anyway we want to exercise specific features later.
Message-ID: <[email protected]>
---
v2
- pass "host" cpu type for KVM run
--- tests/functional/aarch64/test_tuxrun.py | 10 ++++++++++ 1 file changed, 10 insertions(+)
tests/functional/aarch64/test_tuxrun.py +10 -0
@@ -32,6 +32,16 @@ def test_arm64(self): self.common_tuxrun(kernel_asset=self.ASSET_ARM64_KERNEL, rootfs_asset=self.ASSET_ARM64_ROOTFS) + def test_arm64_kvm(self): + self.set_machine('virt') + self.require_accelerator('kvm') + self.cpu='host' + self.console='ttyAMA0' + self.wait_for_shutdown=False + self.common_tuxrun(kernel_asset=self.ASSET_ARM64_KERNEL, + rootfs_asset=self.ASSET_ARM64_ROOTFS, + accel="kvm") + ASSET_ARM64BE_KERNEL = Asset( 'https://storage.tuxboot.com/buildroot/20241119/arm64be/Image', 'fd6af4f16689d17a2c24fe0053cc212edcdf77abdcaf301800b8d38fa9f6e109')
Signature · 1 line
2.47.3
Re: [PATCH v2 11/16] tests/functional: split aarch64 tuxrun into tcg and kvm run
Quoted 9 lines · Alex Bennée
Add an explicit "kvm" run to the tuxrun tests. Although running on an aarch64 host would probably have defaulted to "kvm" anyway we want to exercise specific features later.
Reviewed-by Marc-André Lureau <[email protected]>Message-ID: <[email protected]>
Signed-off-by Alex Bennée <[email protected]>[...]
Signature · 1 line
Marc-André Lureau <[email protected]>
PATCH v2 12/16 tests/functional: update arm64 tuxrun images
In reply to Alex BennéeWe now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
--- tests/functional/aarch64/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/aarch64/test_tuxrun.py +4 -4
@@ -17,11 +17,11 @@ class TuxRunAarch64Test(TuxRunBaselineTest): ASSET_ARM64_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/arm64/Image', - 'b74743c5e89e1cea0f73368d24ae0ae85c5204ff84be3b5e9610417417d2f235') + 'https://storage.tuxboot.com/kernels/6.18.54/arm64/Image.gz', + '39f4633bbcb444267d4d829bd28d8868a287c4c160cda64b0fd23fb090571c4e') ASSET_ARM64_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/arm64/rootfs.ext4.zst', - 'a1acaaae2068df4648d04ff75f532aaa8c5edcd6b936122b6f0db4848a07b465') + 'https://storage.tuxboot.com/buildroot/20260924/arm64/rootfs.ext4.zst', + '4ab8cec9d1e17dbb1abdf2ae1939ad4f9d0dc2466230f6a119a7c1845cdef0b1') def test_arm64(self): self.set_machine('virt')
Signature · 1 line
2.47.3
Re: [PATCH v2 12/16] tests/functional: update arm64 tuxrun images
Quoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
Signature · 1 line
Marc-André Lureau <[email protected]>
Re: [PATCH v2 12/16] tests/functional: update arm64 tuxrun images
In reply to Alex BennéeQuoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
The commit message looks unrelated
Quoted 29 lines
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/aarch64/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)tests/functional/aarch64/test_tuxrun.py +4
-4@@ -17,11 +17,11 @@ class TuxRunAarch64Test(TuxRunBaselineTest): ASSET_ARM64_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/arm64/Image', - 'b74743c5e89e1cea0f73368d24ae0ae85c5204ff84be3b5e9610417417d2f235') + 'https://storage.tuxboot.com/kernels/6.18.54/arm64/Image.gz', + '39f4633bbcb444267d4d829bd28d8868a287c4c160cda64b0fd23fb090571c4e') ASSET_ARM64_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/arm64/rootfs.ext4.zst', - 'a1acaaae2068df4648d04ff75f532aaa8c5edcd6b936122b6f0db4848a07b465') + 'https://storage.tuxboot.com/buildroot/20260924/arm64/rootfs.ext4.zst', + '4ab8cec9d1e17dbb1abdf2ae1939ad4f9d0dc2466230f6a119a7c1845cdef0b1') def test_arm64(self): self.set_machine('virt')Signature · 1 line
2.47.3
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Re: [PATCH v2 12/16] tests/functional: update arm64 tuxrun images
Quoted 6 lines · Daniel P. Berrangé
Quoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
The commit message looks unrelated
Could I word it more clearly?
Quoted 33 lines
Quoted 30 lines
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/aarch64/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)tests/functional/aarch64/test_tuxrun.py +4
-4@@ -17,11 +17,11 @@ class TuxRunAarch64Test(TuxRunBaselineTest): ASSET_ARM64_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/arm64/Image', - 'b74743c5e89e1cea0f73368d24ae0ae85c5204ff84be3b5e9610417417d2f235') + 'https://storage.tuxboot.com/kernels/6.18.54/arm64/Image.gz', + '39f4633bbcb444267d4d829bd28d8868a287c4c160cda64b0fd23fb090571c4e') ASSET_ARM64_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/arm64/rootfs.ext4.zst', - 'a1acaaae2068df4648d04ff75f532aaa8c5edcd6b936122b6f0db4848a07b465') + 'https://storage.tuxboot.com/buildroot/20260924/arm64/rootfs.ext4.zst', + '4ab8cec9d1e17dbb1abdf2ae1939ad4f9d0dc2466230f6a119a7c1845cdef0b1') def test_arm64(self): self.set_machine('virt')Signature · 1 line
2.47.3With regards,
Daniel
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
PATCH v2 13/16 tests/functional: add tuxrun kvm gdb test for arm64
In reply to Alex BennéeAs with x86_64 we now have the bits to add a KVM gdb test
--- tests/functional/aarch64/test_tuxrun.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
tests/functional/aarch64/test_tuxrun.py +16 -1
@@ -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 TuxRunAarch64Test(TuxRunBaselineTest):
@@ -19,6 +19,9 @@ class TuxRunAarch64Test(TuxRunBaselineTest): ASSET_ARM64_KERNEL = Asset( 'https://storage.tuxboot.com/kernels/6.18.54/arm64/Image.gz', '39f4633bbcb444267d4d829bd28d8868a287c4c160cda64b0fd23fb090571c4e') + ASSET_ARM64_VMLINUX = Asset( + 'https://storage.tuxboot.com/kernels/6.18.54/arm64/vmlinux.xz', + '6487eb113ef6e841aedab6cb6fa704006377d68f64dd544570aa42f462a52b85') ASSET_ARM64_ROOTFS = Asset( 'https://storage.tuxboot.com/buildroot/20260924/arm64/rootfs.ext4.zst', '4ab8cec9d1e17dbb1abdf2ae1939ad4f9d0dc2466230f6a119a7c1845cdef0b1')
@@ -42,6 +45,18 @@ def test_arm64_kvm(self): rootfs_asset=self.ASSET_ARM64_ROOTFS, accel="kvm") + @skipIfMissingEnv("QEMU_TEST_GDB") + def test_arm64_kvm_gdb(self): + self.set_machine('virt') + self.require_accelerator('kvm') + self.cpu='host' + self.console='ttyAMA0' + self.wait_for_shutdown=False + self.common_tuxrun_gdb(kernel_asset=self.ASSET_ARM64_KERNEL, + vmlinux_asset=self.ASSET_ARM64_VMLINUX, + rootfs_asset=self.ASSET_ARM64_ROOTFS, + accel="kvm") + ASSET_ARM64BE_KERNEL = Asset( 'https://storage.tuxboot.com/buildroot/20241119/arm64be/Image', 'fd6af4f16689d17a2c24fe0053cc212edcdf77abdcaf301800b8d38fa9f6e109')
Signature · 1 line
2.47.3
Re: [PATCH v2 13/16] tests/functional: add tuxrun kvm gdb test for arm64
Quoted 1 line · Alex Bennée
As with
x86_64we now have the bits to add a KVM gdb test
Signature · 1 line
Marc-André Lureau <[email protected]>
PATCH v2 14/16 tests/functional: split s390x tuxrun into tcg and kvm run
In reply to Alex BennéeAdd an explicit "kvm" run to the tuxrun tests. Although running on an s390x host would probably have defaulted to "kvm" anyway we want to exercise specific features later.
--- tests/functional/s390x/test_tuxrun.py | 11 +++++++++++ 1 file changed, 11 insertions(+)
tests/functional/s390x/test_tuxrun.py +11 -0
@@ -25,11 +25,22 @@ class TuxRunS390xTest(TuxRunBaselineTest): def test_s390(self): self.set_machine('s390-ccw-virtio') + self.require_accelerator('tcg') self.wait_for_shutdown=False self.common_tuxrun(kernel_asset=self.ASSET_S390X_KERNEL, rootfs_asset=self.ASSET_S390X_ROOTFS, drive="virtio-blk-ccw", haltmsg="Requesting system halt") + def test_s390_kvm(self): + self.set_machine('s390-ccw-virtio') + self.require_accelerator('kvm') + self.wait_for_shutdown=False + self.common_tuxrun(kernel_asset=self.ASSET_S390X_KERNEL, + rootfs_asset=self.ASSET_S390X_ROOTFS, + drive="virtio-blk-ccw", + haltmsg="Requesting system halt", + accel="kvm") + if __name__ == '__main__': TuxRunBaselineTest.main()
Signature · 1 line
2.47.3
Re: [PATCH v2 14/16] tests/functional: split s390x tuxrun into tcg and kvm run
Quoted 3 lines · Alex Bennée
Add an explicit "kvm" run to the tuxrun tests. Although running on an s390x host would probably have defaulted to "kvm" anyway we want to exercise specific features later.
Signature · 1 line
Marc-André Lureau <[email protected]>
Re: [PATCH v2 14/16] tests/functional: split s390x tuxrun into tcg and kvm run
In reply to Alex BennéeQuoted 8 lines · Alex Bennée
Add an explicit "kvm" run to the tuxrun tests. Although running on an s390x host would probably have defaulted to "kvm" anyway we want to exercise specific features later.
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/s390x/test_tuxrun.py | 11 +++++++++++ 1 file changed, 11 insertions(+)
PATCH v2 15/16 tests/functional: update s390x tuxrun images
In reply to Alex BennéeWe now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
--- tests/functional/s390x/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tests/functional/s390x/test_tuxrun.py +4 -4
@@ -17,11 +17,11 @@ class TuxRunS390xTest(TuxRunBaselineTest): ASSET_S390X_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/s390/bzImage', - 'ee67e91db52a2aed104a7c72b2a08987c678f8179c029626789c35d6dd0fedf1') + 'https://storage.tuxboot.com/kernels/6.18.54/s390/bzImage', + '5efeb31754b211440e1595ab11355bb006fe78a2c0604ed0a8c55c4598b71aec') ASSET_S390X_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/s390/rootfs.ext4.zst', - 'bff7971fc2fef56372d98afe4557b82fd0a785a241e44c29b058e577ad1bbb44') + 'https://storage.tuxboot.com/buildroot/20260924/s390/rootfs.ext4.zst', + '5ba18c4d18831c50a0c743990f7bdee1d3b520629d423c55b668d8fbbac9c6f5') def test_s390(self): self.set_machine('s390-ccw-virtio')
Signature · 1 line
2.47.3
Re: [PATCH v2 15/16] tests/functional: update s390x tuxrun images
Quoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
Signature · 1 line
Marc-André Lureau <[email protected]>
Re: [PATCH v2 15/16] tests/functional: update s390x tuxrun images
In reply to Alex BennéeQuoted 3 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
This commit message appears unrelated
Quoted 29 lines
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/s390x/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)tests/functional/s390x/test_tuxrun.py +4
-4@@ -17,11 +17,11 @@ class TuxRunS390xTest(TuxRunBaselineTest): ASSET_S390X_KERNEL = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/s390/bzImage', - 'ee67e91db52a2aed104a7c72b2a08987c678f8179c029626789c35d6dd0fedf1') + 'https://storage.tuxboot.com/kernels/6.18.54/s390/bzImage', + '5efeb31754b211440e1595ab11355bb006fe78a2c0604ed0a8c55c4598b71aec') ASSET_S390X_ROOTFS = Asset( - 'https://storage.tuxboot.com/buildroot/20241119/s390/rootfs.ext4.zst', - 'bff7971fc2fef56372d98afe4557b82fd0a785a241e44c29b058e577ad1bbb44') + 'https://storage.tuxboot.com/buildroot/20260924/s390/rootfs.ext4.zst', + '5ba18c4d18831c50a0c743990f7bdee1d3b520629d423c55b668d8fbbac9c6f5') def test_s390(self): self.set_machine('s390-ccw-virtio')Signature · 1 line
2.47.3
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Re: [PATCH v2 15/16] tests/functional: update s390x tuxrun images
In reply to Alex BennéeQuoted 8 lines · Alex Bennée
We now split the fetching of the buildroot image from the kernel itself. This is because we will want to access additional metadata in future tests.
Signed-off-by Alex Bennée <[email protected]>--- tests/functional/s390x/test_tuxrun.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
PATCH v2 16/16 tests/functional: add tuxrun kvm gdb test for s390x
In reply to Alex BennéeAs with x86_64 we now have the bits to add a KVM gdb test. One 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.
--- tests/functional/gdb-scripts/kernel_gdb_test.py | 10 ++++++---- tests/functional/s390x/test_tuxrun.py | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-)
tests/functional/gdb-scripts/kernel_gdb_test.py +6 -4
@@ -107,11 +107,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")
tests/functional/s390x/test_tuxrun.py +14 -0
@@ -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,16 @@ def test_s390_kvm(self): haltmsg="Requesting system halt", accel="kvm") + 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, + drive="virtio-blk-ccw", + haltmsg="Requesting system halt", + accel="kvm") + if __name__ == '__main__': TuxRunBaselineTest.main()
Signature · 1 line
2.47.3
Re: [PATCH v2 16/16] tests/functional: add tuxrun kvm gdb test for s390x
Quoted 45 lines
As with
x86_64we now have the bits to add a KVM gdb test. One minor wrinkle is the s390x only supportsWP_WRITEwatch points so we skip the other watch point tests lest we get confusing messages about failing to insert HW breakpoints.Signed-off-by Alex Bennée <[email protected]>Message-ID: <[email protected]>
tests/functional/gdb-scripts/kernel_gdb_test.py +6
-4@@ -107,11 +107,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")tests/functional/s390x/test_tuxrun.py +3
-0@@ -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')
tests/functional/s390x/test_tuxrun.py def test_s390_kvm(self): · line 48
Quoted 4 lines
tests/functional/s390x/test_tuxrun.py +1
-0@@ -42,5 +45,16 @@ def test_s390_kvm(self): haltmsg="Requesting system halt", accel="kvm") + def test_s390_kvm_gdb(self):
Missing @skipIfMissingEnv("QEMU_TEST_GDB") decorator, which the x86_64 and arm64 versions both have
Signature · 1 line
Marc-André Lureau <[email protected]>
Re: [PATCH v2 16/16] tests/functional: add tuxrun kvm gdb test for s390x
In reply to Alex BennéeQuoted 54 lines · Alex Bennée
As with
x86_64we now have the bits to add a KVM gdb test. One minor wrinkle is the s390x only supportsWP_WRITEwatch points so we skip the other watch point tests lest we get confusing messages about failing to insert HW breakpoints.Signed-off-by Alex Bennée <[email protected]>--- tests/functional/gdb-scripts/kernel_gdb_test.py | 10 ++++++---- tests/functional/s390x/test_tuxrun.py | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-)tests/functional/gdb-scripts/kernel_gdb_test.py +6
-4@@ -107,11 +107,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")tests/functional/s390x/test_tuxrun.py +6
-0@@ -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,16 @@ def test_s390_kvm(self): haltmsg="Requesting system halt", accel="kvm") + def test_s390_kvm_gdb(self): + self.set_machine('s390-ccw-virtio') + self.require_accelerator('kvm')
tests/functional/s390x/test_tuxrun.py def test_s390_kvm(self): · line 60
Quoted 10 lines
tests/functional/s390x/test_tuxrun.py +8
-0+ 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, + drive="virtio-blk-ccw", + haltmsg="Requesting system halt", + accel="kvm") + if __name__ == '__main__': TuxRunBaselineTest.main()
This hangs unfortunately.
You need something like the following to compensate for the difference between vmlinux ELF addresses and the actual nokaslr load address:
tests/functional/qemu_test/tuxruntest.py +4 -1
@@ -160,7 +160,8 @@ def common_tuxrun_gdb(self, dtb_asset=None, drive="virtio-blk-device", haltmsg="reboot: System halted", - console_index=0): + console_index=0, + symbols_offset=None): """ Common path for LKFT tests under gdb. Unlike the common_tuxrun function we need to launch with the gdb test script and deal
@@ -204,6 +205,8 @@ def common_tuxrun_gdb(self, "--test", str(test_script), "--gdb", gdb_path, ] + if symbols_offset is not None: + cmd += ["--symbols-offset", hex(symbols_offset)] self.log.info(f"run-test: {' '.join(cmd)}")
tests/functional/s390x/test_tuxrun.py +2 -1
@@ -54,7 +54,8 @@ def test_s390_kvm_gdb(self): rootfs_asset=self.ASSET_S390X_ROOTFS, drive="virtio-blk-ccw", haltmsg="Requesting system halt", - accel="kvm") + accel="kvm", + symbols_offset=0x3ffe0000000) if __name__ == '__main__': TuxRunBaselineTest.main()
tests/guest-debug/run-test.py +0 -0
@@ -29,6 +29,8 @@ def get_args(): parser.add_argument("--binary", help="Binary to debug", required=True) parser.add_argument("--symbols", help="Symbol file for binary to
debug")
+ parser.add_argument("--symbols-offset",
+ help="Offset to add to the symbol file's addresses")
parser.add_argument("--test", help="GDB test script") parser.add_argument('test_args', nargs='*',
help="Additional args for GDB test script. "
@@ -117,7 +119,10 @@ def log(output, msg):
gdb_cmd += " -ex 'target remote %s'" % (socket_name)
if args.symbols:
- gdb_cmd += " -ex 'symbol-file %s'" % args.symbols
+ gdb_cmd += " -ex 'symbol-file %s" % args.symbols
+ if args.symbols_offset:+ gdb_cmd += " -o %s" % args.symbols_offset
+ gdb_cmd += "'"
# finally the test script itself
if args.test:Re: [PATCH v2 16/16] tests/functional: add tuxrun kvm gdb test for s390x
Quoted 56 lines · Ilya Leoshkevich
Quoted 55 lines · Alex Bennée
As with
x86_64we now have the bits to add a KVM gdb test. One minor wrinkle is the s390x only supportsWP_WRITEwatch points so we skip the other watch point tests lest we get confusing messages about failing to insert HW breakpoints.Signed-off-by Alex Bennée <[email protected]>--- tests/functional/gdb-scripts/kernel_gdb_test.py | 10 ++++++---- tests/functional/s390x/test_tuxrun.py | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 4 deletions(-)tests/functional/gdb-scripts/kernel_gdb_test.py +6
-2@@ -107,11 +107,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")tests/functional/s390x/test_tuxrun.py +11
-0@@ -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,16 @@ def test_s390_kvm(self): haltmsg="Requesting system halt", accel="kvm") + 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, + drive="virtio-blk-ccw", + haltmsg="Requesting system halt",
Quoted 8 lines
tests/functional/s390x/test_tuxrun.py def test_s390_kvm_gdb(self): · line 61
Quoted 4 lines
tests/functional/s390x/test_tuxrun.py +2
-0+ accel="kvm") + if __name__ == '__main__': TuxRunBaselineTest.main()This hangs unfortunately.
You need something like the following to compensate for the difference between vmlinux ELF addresses and the actual nokaslr load address:
I realise now I had it working on my s390x image and forgot to fold the changes from that tree into my local git. Fixed in v3
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro