From 58e95a05dec8bb0c739a2b7192b6d0a96d1a99a5 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Tue, 19 Aug 2025 13:23:57 +0200 Subject: tests/functional: Move sh4/sh4eb tests into target-specific folders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tests/functional folder has become quite crowded, thus move the sh4 tests into a target-specific subfolder. Reviewed-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth Message-ID: <20250819112403.432587-21-thuth@redhat.com> --- MAINTAINERS | 4 +-- tests/functional/meson.build | 15 ++---------- tests/functional/sh4/meson.build | 10 ++++++++ tests/functional/sh4/test_r2d.py | 29 ++++++++++++++++++++++ tests/functional/sh4/test_tuxrun.py | 49 +++++++++++++++++++++++++++++++++++++ tests/functional/sh4eb/meson.build | 5 ++++ tests/functional/sh4eb/test_r2d.py | 28 +++++++++++++++++++++ tests/functional/test_sh4_r2d.py | 29 ---------------------- tests/functional/test_sh4_tuxrun.py | 49 ------------------------------------- tests/functional/test_sh4eb_r2d.py | 28 --------------------- 10 files changed, 125 insertions(+), 121 deletions(-) create mode 100644 tests/functional/sh4/meson.build create mode 100755 tests/functional/sh4/test_r2d.py create mode 100755 tests/functional/sh4/test_tuxrun.py create mode 100644 tests/functional/sh4eb/meson.build create mode 100755 tests/functional/sh4eb/test_r2d.py delete mode 100755 tests/functional/test_sh4_r2d.py delete mode 100755 tests/functional/test_sh4_tuxrun.py delete mode 100755 tests/functional/test_sh4eb_r2d.py diff --git a/MAINTAINERS b/MAINTAINERS index 4a55a20..eddec00 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1736,8 +1736,8 @@ F: hw/pci-host/sh_pci.c F: hw/timer/sh_timer.c F: include/hw/sh4/sh_intc.h F: include/hw/timer/tmu012.h -F: tests/functional/test_sh4*_r2d.py -F: tests/functional/test_sh4_tuxrun.py +F: tests/functional/sh4*/test_r2d.py +F: tests/functional/sh4/test_tuxrun.py SPARC Machines -------------- diff --git a/tests/functional/meson.build b/tests/functional/meson.build index abaa4e0..ce71350 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -30,10 +30,8 @@ subdir('riscv32') subdir('riscv64') subdir('rx') subdir('s390x') - -test_sh4_timeouts = { - 'sh4_tuxrun' : 240, -} +subdir('sh4') +subdir('sh4eb') test_x86_64_timeouts = { 'acpi_bits' : 420, @@ -56,15 +54,6 @@ tests_generic_linuxuser = [ tests_generic_bsduser = [ ] -tests_sh4_system_thorough = [ - 'sh4_r2d', - 'sh4_tuxrun', -] - -tests_sh4eb_system_thorough = [ - 'sh4eb_r2d', -] - tests_sparc_system_quick = [ 'sparc_migration', ] diff --git a/tests/functional/sh4/meson.build b/tests/functional/sh4/meson.build new file mode 100644 index 0000000..56f824e --- /dev/null +++ b/tests/functional/sh4/meson.build @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +test_sh4_timeouts = { + 'tuxrun' : 240, +} + +tests_sh4_system_thorough = [ + 'r2d', + 'tuxrun', +] diff --git a/tests/functional/sh4/test_r2d.py b/tests/functional/sh4/test_r2d.py new file mode 100755 index 0000000..03a64837 --- /dev/null +++ b/tests/functional/sh4/test_r2d.py @@ -0,0 +1,29 @@ +#!/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 + +from qemu_test import LinuxKernelTest, Asset, skipFlakyTest + + +class R2dTest(LinuxKernelTest): + + ASSET_DAY09 = Asset( + 'https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/day09.tar.xz', + 'a61b44d2630a739d1380cc4ff4b80981d47ccfd5992f1484ccf48322c35f09ac') + + # This test has a 6-10% failure rate on various hosts that look + # like issues with a buggy kernel. + # XXX file tracking bug + @skipFlakyTest(bug_url=None) + def test_r2d(self): + self.set_machine('r2d') + self.archive_extract(self.ASSET_DAY09) + self.vm.add_args('-append', 'console=ttySC1') + self.launch_kernel(self.scratch_file('day09', 'zImage'), + console_index=1, + wait_for='QEMU advent calendar') + +if __name__ == '__main__': + LinuxKernelTest.main() diff --git a/tests/functional/sh4/test_tuxrun.py b/tests/functional/sh4/test_tuxrun.py new file mode 100755 index 0000000..1748f8c --- /dev/null +++ b/tests/functional/sh4/test_tuxrun.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +# +# Functional test that boots known good tuxboot images the same way +# that tuxrun (www.tuxrun.org) does. This tool is used by things like +# the LKFT project to run regression tests on kernels. +# +# Copyright (c) 2023 Linaro Ltd. +# +# Author: +# Alex Bennée +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import Asset, exec_command_and_wait_for_pattern +from qemu_test.tuxruntest import TuxRunBaselineTest + +class TuxRunSh4Test(TuxRunBaselineTest): + + ASSET_SH4_KERNEL = Asset( + 'https://storage.tuxboot.com/20230331/sh4/zImage', + '29d9b2aba604a0f53a5dc3b5d0f2b8e35d497de1129f8ee5139eb6fdf0db692f') + ASSET_SH4_ROOTFS = Asset( + 'https://storage.tuxboot.com/20230331/sh4/rootfs.ext4.zst', + '3592a7a3d5a641e8b9821449e77bc43c9904a56c30d45da0694349cfd86743fd') + + def test_sh4(self): + self.set_machine('r2d') + self.cpu='sh7785' + self.root='sda' + self.console='ttySC1' + + # The test is currently too unstable to do much in userspace + # so we skip common_tuxrun and do a minimal boot and shutdown. + (kernel, disk, dtb) = self.fetch_tuxrun_assets(self.ASSET_SH4_KERNEL, + self.ASSET_SH4_ROOTFS) + + # the console comes on the second serial port + self.prepare_run(kernel, disk, + "driver=ide-hd,bus=ide.0,unit=0", + console_index=1) + self.vm.launch() + + self.wait_for_console_pattern("tuxtest login:") + exec_command_and_wait_for_pattern(self, 'root', 'root@tuxtest:~#') + exec_command_and_wait_for_pattern(self, 'halt', + "reboot: System halted") + +if __name__ == '__main__': + TuxRunBaselineTest.main() diff --git a/tests/functional/sh4eb/meson.build b/tests/functional/sh4eb/meson.build new file mode 100644 index 0000000..25e9a6e --- /dev/null +++ b/tests/functional/sh4eb/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +tests_sh4eb_system_thorough = [ + 'r2d', +] diff --git a/tests/functional/sh4eb/test_r2d.py b/tests/functional/sh4eb/test_r2d.py new file mode 100755 index 0000000..473093b --- /dev/null +++ b/tests/functional/sh4eb/test_r2d.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python3 +# +# Boot a Linux kernel on a r2d sh4eb machine and check the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from qemu_test import LinuxKernelTest, Asset +from qemu_test import exec_command_and_wait_for_pattern + + +class R2dEBTest(LinuxKernelTest): + + ASSET_TGZ = Asset( + 'https://landley.net/bin/mkroot/0.8.11/sh4eb.tgz', + 'be8c6cb5aef8406899dc5aa5e22b6aa45840eb886cdd3ced51555c10577ada2c') + + def test_sh4eb_r2d(self): + self.set_machine('r2d') + self.archive_extract(self.ASSET_TGZ) + self.vm.add_args('-append', 'console=ttySC1 noiotrap') + self.launch_kernel(self.scratch_file('sh4eb', 'linux-kernel'), + initrd=self.scratch_file('sh4eb', + 'initramfs.cpio.gz'), + console_index=1, wait_for='Type exit when done') + exec_command_and_wait_for_pattern(self, 'exit', 'Restarting system') + +if __name__ == '__main__': + LinuxKernelTest.main() diff --git a/tests/functional/test_sh4_r2d.py b/tests/functional/test_sh4_r2d.py deleted file mode 100755 index 03a64837..0000000 --- a/tests/functional/test_sh4_r2d.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/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 - -from qemu_test import LinuxKernelTest, Asset, skipFlakyTest - - -class R2dTest(LinuxKernelTest): - - ASSET_DAY09 = Asset( - 'https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/day09.tar.xz', - 'a61b44d2630a739d1380cc4ff4b80981d47ccfd5992f1484ccf48322c35f09ac') - - # This test has a 6-10% failure rate on various hosts that look - # like issues with a buggy kernel. - # XXX file tracking bug - @skipFlakyTest(bug_url=None) - def test_r2d(self): - self.set_machine('r2d') - self.archive_extract(self.ASSET_DAY09) - self.vm.add_args('-append', 'console=ttySC1') - self.launch_kernel(self.scratch_file('day09', 'zImage'), - console_index=1, - wait_for='QEMU advent calendar') - -if __name__ == '__main__': - LinuxKernelTest.main() diff --git a/tests/functional/test_sh4_tuxrun.py b/tests/functional/test_sh4_tuxrun.py deleted file mode 100755 index 1748f8c..0000000 --- a/tests/functional/test_sh4_tuxrun.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python3 -# -# Functional test that boots known good tuxboot images the same way -# that tuxrun (www.tuxrun.org) does. This tool is used by things like -# the LKFT project to run regression tests on kernels. -# -# Copyright (c) 2023 Linaro Ltd. -# -# Author: -# Alex Bennée -# -# SPDX-License-Identifier: GPL-2.0-or-later - -from qemu_test import Asset, exec_command_and_wait_for_pattern -from qemu_test.tuxruntest import TuxRunBaselineTest - -class TuxRunSh4Test(TuxRunBaselineTest): - - ASSET_SH4_KERNEL = Asset( - 'https://storage.tuxboot.com/20230331/sh4/zImage', - '29d9b2aba604a0f53a5dc3b5d0f2b8e35d497de1129f8ee5139eb6fdf0db692f') - ASSET_SH4_ROOTFS = Asset( - 'https://storage.tuxboot.com/20230331/sh4/rootfs.ext4.zst', - '3592a7a3d5a641e8b9821449e77bc43c9904a56c30d45da0694349cfd86743fd') - - def test_sh4(self): - self.set_machine('r2d') - self.cpu='sh7785' - self.root='sda' - self.console='ttySC1' - - # The test is currently too unstable to do much in userspace - # so we skip common_tuxrun and do a minimal boot and shutdown. - (kernel, disk, dtb) = self.fetch_tuxrun_assets(self.ASSET_SH4_KERNEL, - self.ASSET_SH4_ROOTFS) - - # the console comes on the second serial port - self.prepare_run(kernel, disk, - "driver=ide-hd,bus=ide.0,unit=0", - console_index=1) - self.vm.launch() - - self.wait_for_console_pattern("tuxtest login:") - exec_command_and_wait_for_pattern(self, 'root', 'root@tuxtest:~#') - exec_command_and_wait_for_pattern(self, 'halt', - "reboot: System halted") - -if __name__ == '__main__': - TuxRunBaselineTest.main() diff --git a/tests/functional/test_sh4eb_r2d.py b/tests/functional/test_sh4eb_r2d.py deleted file mode 100755 index 473093b..0000000 --- a/tests/functional/test_sh4eb_r2d.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 -# -# Boot a Linux kernel on a r2d sh4eb machine and check the console -# -# SPDX-License-Identifier: GPL-2.0-or-later - -from qemu_test import LinuxKernelTest, Asset -from qemu_test import exec_command_and_wait_for_pattern - - -class R2dEBTest(LinuxKernelTest): - - ASSET_TGZ = Asset( - 'https://landley.net/bin/mkroot/0.8.11/sh4eb.tgz', - 'be8c6cb5aef8406899dc5aa5e22b6aa45840eb886cdd3ced51555c10577ada2c') - - def test_sh4eb_r2d(self): - self.set_machine('r2d') - self.archive_extract(self.ASSET_TGZ) - self.vm.add_args('-append', 'console=ttySC1 noiotrap') - self.launch_kernel(self.scratch_file('sh4eb', 'linux-kernel'), - initrd=self.scratch_file('sh4eb', - 'initramfs.cpio.gz'), - console_index=1, wait_for='Type exit when done') - exec_command_and_wait_for_pattern(self, 'exit', 'Restarting system') - -if __name__ == '__main__': - LinuxKernelTest.main() -- cgit v1.1