diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2024-09-28 12:34:37 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2024-09-28 12:34:38 +0100 |
commit | 173c427eb5705064da7dc8db22553c8df34f7f58 (patch) | |
tree | 51214f5dfa6d017f18604de05453cb2b3d3fcb2a /tests/functional | |
parent | 4ae7d11b70a840eec7aa27269093b15d04ebc84e (diff) | |
parent | dc05b2628e3913e668590ba66d9c618382d351ae (diff) |
Merge tag 'pull-request-2024-09-25' of https://gitlab.com/thuth/qemu into staging
* Convert more Avocado tests to the new functional test framework
* Clean up assert() statements, use g_assert_not_reached() when possible
* Improve output of the gitlab CI jobs
# -----BEGIN PGP SIGNATURE-----
#
# iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmbz7xgRHHRodXRoQHJl
# ZGhhdC5jb20ACgkQLtnXdP5wLbWm6A//eVn+tzyyKCX/xdXlf7XyVpezvRpTFPOS
# HyO0WMkCf2kGmu6qYKx/fDZg86opdQzPLH2gPkuVrGOMZ0Z2630DjH0jNih8lL9Q
# J1oRX5YlU92chlzNmq59WB/j9CKd91ILtOoaPBuZkDob57yGEYVzCPqetVvF7L2+
# +rbnccrNPumGJFt035fxUGiGfgsmp28MHQzDwQdyr38uGjyNlqvqidfC8Vj1qzqP
# B7HvhGB/vkF0eHaanMt2el/ZuLKf+qeCi//F/CiXGMYnuKXyShA/Db6xvMElw1jB
# aQdwphP71IO+cxjJLaNjDHKGFstArsM/E21qlaSTBi+FTmPiwVULpVTiBmWsjhOh
# /klpdgRHf0hL2MciYKyOWgjlTocx3rEKjCTe2U5tpta9fp9CrlgMQotjDZIbohGI
# ULNahrW3Zmg4EmXDApfhYMXsQsSgWas9QSkmxzJzDp0VC7tf2Oq7RxeySrlw9MCx
# OG2qQY+rNcJ3NnpATjfAJpT1kg/IahDOCNHfLEaj1u13XVQIthVADvHwy5WxbwRP
# mwp3V9e9sUoznkM2eV646lzmkMim/WdYBF0YpT7eBs80+GoXZ0thx9IqWmwzX/ox
# rndBczVN+RY6PydJP40yljdvS7ArRT73wHqL6yKHfDpvFc4/p5mxTWwLQ3yJbXbE
# T3I+wtgfBU8=
# =FH7b
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 25 Sep 2024 12:08:08 BST
# gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5
# gpg: issuer "thuth@redhat.com"
# gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full]
# gpg: aka "Thomas Huth <thuth@redhat.com>" [full]
# gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full]
# gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown]
# Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5
* tag 'pull-request-2024-09-25' of https://gitlab.com/thuth/qemu: (44 commits)
.gitlab-ci.d: Make separate collapsible log sections for build and test
.gitlab-ci.d: Split build and test in cross build job templates
scripts/checkpatch.pl: emit error when using assert(false)
tests/qtest: remove return after g_assert_not_reached()
qom: remove return after g_assert_not_reached()
qobject: remove return after g_assert_not_reached()
migration: remove return after g_assert_not_reached()
hw/ppc: remove return after g_assert_not_reached()
hw/pci: remove return after g_assert_not_reached()
hw/net: remove return after g_assert_not_reached()
hw/hyperv: remove return after g_assert_not_reached()
include/qemu: remove return after g_assert_not_reached()
tcg/loongarch64: remove break after g_assert_not_reached()
fpu: remove break after g_assert_not_reached()
target/riscv: remove break after g_assert_not_reached()
target/arm: remove break after g_assert_not_reached()
hw/tpm: remove break after g_assert_not_reached()
hw/scsi: remove break after g_assert_not_reached()
hw/net: remove break after g_assert_not_reached()
hw/acpi: remove break after g_assert_not_reached()
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/meson.build | 15 | ||||
-rw-r--r-- | tests/functional/qemu_test/linuxkernel.py | 12 | ||||
-rwxr-xr-x | tests/functional/test_arm_vexpress.py | 26 | ||||
-rwxr-xr-x | tests/functional/test_ppc64_e500.py | 25 | ||||
-rwxr-xr-x | tests/functional/test_ppc64_powernv.py | 42 | ||||
-rwxr-xr-x | tests/functional/test_ppc_mac.py | 38 | ||||
-rwxr-xr-x | tests/functional/test_sh4_r2d.py | 31 | ||||
-rwxr-xr-x | tests/functional/test_sparc_sun4m.py | 25 | ||||
-rwxr-xr-x | tests/functional/test_xtensa_lx60.py | 26 |
9 files changed, 237 insertions, 3 deletions
diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 4352e5919b..7713f8eb55 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -50,6 +50,7 @@ tests_arm_system_thorough = [ 'arm_canona1100', 'arm_integratorcp', 'arm_raspi2', + 'arm_vexpress', ] tests_arm_linuxuser_thorough = [ @@ -105,11 +106,13 @@ tests_ppc_system_thorough = [ 'ppc_40p', 'ppc_amiga', 'ppc_bamboo', + 'ppc_mac', 'ppc_mpc8544ds', 'ppc_virtex_ml507', ] tests_ppc64_system_thorough = [ + 'ppc64_e500', 'ppc64_hv', 'ppc64_powernv', 'ppc64_pseries', @@ -124,6 +127,14 @@ tests_s390x_system_thorough = [ 's390x_topology', ] +tests_sh4_system_thorough = [ + 'sh4_r2d', +] + +tests_sparc_system_thorough = [ + 'sparc_sun4m', +] + tests_sparc64_system_thorough = [ 'sparc64_sun4u', ] @@ -144,6 +155,10 @@ tests_x86_64_system_thorough = [ 'virtio_gpu', ] +tests_xtensa_system_thorough = [ + 'xtensa_lx60', +] + precache_all = [] foreach speed : ['quick', 'thorough'] foreach dir : target_dirs diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/qemu_test/linuxkernel.py index fdd5307629..2b5b9a5fda 100644 --- a/tests/functional/qemu_test/linuxkernel.py +++ b/tests/functional/qemu_test/linuxkernel.py @@ -17,6 +17,18 @@ class LinuxKernelTest(QemuSystemTest): failure_message='Kernel panic - not syncing', vm=vm) + def launch_kernel(self, kernel, initrd=None, dtb=None, console_index=0, + wait_for=None): + self.vm.set_console(console_index=console_index) + self.vm.add_args('-kernel', kernel) + if initrd: + self.vm.add_args('-initrd', initrd) + if dtb: + self.vm.add_args('-dtb', dtb) + self.vm.launch() + if wait_for: + self.wait_for_console_pattern(wait_for) + def extract_from_deb(self, deb_path, path): """ Extracts a file from a deb package into the test workdir diff --git a/tests/functional/test_arm_vexpress.py b/tests/functional/test_arm_vexpress.py new file mode 100755 index 0000000000..cc6015112b --- /dev/null +++ b/tests/functional/test_arm_vexpress.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# +# Functional test that boots a Linux kernel on an versatile express machine +# and checks the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import LinuxKernelTest, Asset +from qemu_test.utils import archive_extract + +class VExpressTest(LinuxKernelTest): + + ASSET_DAY16 = Asset( + 'https://www.qemu-advent-calendar.org/2018/download/day16.tar.xz', + '63311adb2d4c4e7a73214a86d29988add87266a909719c56acfadd026b4110a7') + + def test_arm_vexpressa9(self): + self.set_machine('vexpress-a9') + file_path = self.ASSET_DAY16.fetch() + archive_extract(file_path, self.workdir) + self.launch_kernel(self.workdir + '/day16/winter.zImage', + dtb=self.workdir + '/day16/vexpress-v2p-ca9.dtb', + wait_for='QEMU advent calendar') + +if __name__ == '__main__': + LinuxKernelTest.main() diff --git a/tests/functional/test_ppc64_e500.py b/tests/functional/test_ppc64_e500.py new file mode 100755 index 0000000000..3558ae0c8c --- /dev/null +++ b/tests/functional/test_ppc64_e500.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# +# Boot a Linux kernel on a e500 ppc64 machine and check the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import LinuxKernelTest, Asset +from qemu_test.utils import archive_extract + +class E500Test(LinuxKernelTest): + + ASSET_DAY19 = Asset( + 'https://www.qemu-advent-calendar.org/2018/download/day19.tar.xz', + '20b1bb5a8488c664defbb5d283addc91a05335a936c63b3f5ff7eee74b725755') + + def test_ppc64_e500(self): + self.set_machine('ppce500') + self.cpu = 'e5500' + file_path = self.ASSET_DAY19.fetch() + archive_extract(file_path, self.workdir) + self.launch_kernel(self.workdir + '/day19/uImage', + wait_for='QEMU advent calendar') + +if __name__ == '__main__': + LinuxKernelTest.main() diff --git a/tests/functional/test_ppc64_powernv.py b/tests/functional/test_ppc64_powernv.py index 67497d6404..685e2178ed 100755 --- a/tests/functional/test_ppc64_powernv.py +++ b/tests/functional/test_ppc64_powernv.py @@ -7,10 +7,10 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from qemu_test import QemuSystemTest, Asset +from qemu_test import LinuxKernelTest, Asset from qemu_test import wait_for_console_pattern -class powernvMachine(QemuSystemTest): +class powernvMachine(LinuxKernelTest): timeout = 90 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 console=hvc0 ' @@ -78,5 +78,41 @@ class powernvMachine(QemuSystemTest): wait_for_console_pattern(self, console_pattern, self.panic_message) wait_for_console_pattern(self, self.good_message, self.panic_message) + + ASSET_EPAPR_KERNEL = Asset( + ('https://github.com/open-power/op-build/releases/download/v2.7/' + 'zImage.epapr'), + '0ab237df661727e5392cee97460e8674057a883c5f74381a128fa772588d45cd') + + def do_test_ppc64_powernv(self, proc): + self.require_accelerator("tcg") + kernel_path = self.ASSET_EPAPR_KERNEL.fetch() + self.vm.set_console() + self.vm.add_args('-kernel', kernel_path, + '-append', 'console=tty0 console=hvc0', + '-device', 'pcie-pci-bridge,id=bridge1,bus=pcie.1,addr=0x0', + '-device', 'nvme,bus=pcie.2,addr=0x0,serial=1234', + '-device', 'e1000e,bus=bridge1,addr=0x3', + '-device', 'nec-usb-xhci,bus=bridge1,addr=0x2') + self.vm.launch() + + self.wait_for_console_pattern("CPU: " + proc + " generation processor") + self.wait_for_console_pattern("zImage starting: loaded") + self.wait_for_console_pattern("Run /init as init process") + # Device detection output driven by udev probing is sometimes cut off + # from console output, suspect S14silence-console init script. + + def test_powernv8(self): + self.set_machine('powernv8') + self.do_test_ppc64_powernv('P8') + + def test_powernv9(self): + self.set_machine('powernv9') + self.do_test_ppc64_powernv('P9') + + def test_powernv10(self): + self.set_machine('powernv10') + self.do_test_ppc64_powernv('P10') + if __name__ == '__main__': - QemuSystemTest.main() + LinuxKernelTest.main() diff --git a/tests/functional/test_ppc_mac.py b/tests/functional/test_ppc_mac.py new file mode 100755 index 0000000000..a6b1ca2d4c --- /dev/null +++ b/tests/functional/test_ppc_mac.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +# +# Boot Linux kernel on a mac99 and g3beige ppc machine and check the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import LinuxKernelTest, Asset +from qemu_test.utils import archive_extract + +class MacTest(LinuxKernelTest): + + ASSET_DAY15 = Asset( + 'https://www.qemu-advent-calendar.org/2018/download/day15.tar.xz', + '03e0757c131d2959decf293a3572d3b96c5a53587165bf05ce41b2818a2bccd5') + + def do_day15_test(self): + # mac99 also works with kvm_pr but we don't have a reliable way at + # the moment (e.g. by looking at /proc/modules) to detect whether + # we're running kvm_hv or kvm_pr. For now let's disable this test + # if we don't have TCG support. + self.require_accelerator("tcg") + + file_path = self.ASSET_DAY15.fetch() + archive_extract(file_path, self.workdir) + self.vm.add_args('-M', 'graphics=off') + self.launch_kernel(self.workdir + '/day15/invaders.elf', + wait_for='QEMU advent calendar') + + def test_ppc_g3beige(self): + self.set_machine('g3beige') + self.do_day15_test() + + def test_ppc_mac99(self): + self.set_machine('mac99') + self.do_day15_test() + +if __name__ == '__main__': + LinuxKernelTest.main() diff --git a/tests/functional/test_sh4_r2d.py b/tests/functional/test_sh4_r2d.py new file mode 100755 index 0000000000..5fe8cf9f8d --- /dev/null +++ b/tests/functional/test_sh4_r2d.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python3 +# +# Boot a Linux kernel on a r2d sh4 machine and check the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os + +from qemu_test import LinuxKernelTest, Asset +from qemu_test.utils import archive_extract +from unittest import skipUnless + +class R2dTest(LinuxKernelTest): + + ASSET_DAY09 = Asset( + 'https://www.qemu-advent-calendar.org/2018/download/day09.tar.xz', + 'a61b44d2630a739d1380cc4ff4b80981d47ccfd5992f1484ccf48322c35f09ac') + + # This test has a 6-10% failure rate on various hosts that look + # like issues with a buggy kernel. + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable') + def test_r2d(self): + self.set_machine('r2d') + file_path = self.ASSET_DAY09.fetch() + archive_extract(file_path, self.workdir) + self.vm.add_args('-append', 'console=ttySC1') + self.launch_kernel(self.workdir + '/day09/zImage', console_index=1, + wait_for='QEMU advent calendar') + +if __name__ == '__main__': + LinuxKernelTest.main() diff --git a/tests/functional/test_sparc_sun4m.py b/tests/functional/test_sparc_sun4m.py new file mode 100755 index 0000000000..b334375820 --- /dev/null +++ b/tests/functional/test_sparc_sun4m.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 +# +# Functional test that boots a Linux kernel on a sparc sun4m machine +# and checks the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import LinuxKernelTest, Asset +from qemu_test.utils import archive_extract + +class Sun4mTest(LinuxKernelTest): + + ASSET_DAY11 = Asset( + 'https://www.qemu-advent-calendar.org/2018/download/day11.tar.xz', + 'c776533ba756bf4dd3f1fc4c024fb50ef0d853e05c5f5ddf0900a32d1eaa49e0') + + def test_sparc_ss20(self): + self.set_machine('SS-20') + file_path = self.ASSET_DAY11.fetch() + archive_extract(file_path, self.workdir) + self.launch_kernel(self.workdir + '/day11/zImage.elf', + wait_for='QEMU advent calendar') + +if __name__ == '__main__': + LinuxKernelTest.main() diff --git a/tests/functional/test_xtensa_lx60.py b/tests/functional/test_xtensa_lx60.py new file mode 100755 index 0000000000..8ce5206a4f --- /dev/null +++ b/tests/functional/test_xtensa_lx60.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# +# Functional test that boots a Linux kernel on an xtensa lx650 machine +# and checks the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import LinuxKernelTest, Asset +from qemu_test.utils import archive_extract + +class XTensaLX60Test(LinuxKernelTest): + + ASSET_DAY02 = Asset( + 'https://www.qemu-advent-calendar.org/2018/download/day02.tar.xz', + '68ff07f9b3fd3df36d015eb46299ba44748e94bfbb2d5295fddc1a8d4a9fd324') + + def test_xtensa_lx60(self): + self.set_machine('lx60') + self.cpu = 'dc233c' + file_path = self.ASSET_DAY02.fetch() + archive_extract(file_path, self.workdir) + self.launch_kernel(self.workdir + '/day02/santas-sleigh-ride.elf', + wait_for='QEMU advent calendar') + +if __name__ == '__main__': + LinuxKernelTest.main() |