tests/functional: Convert Raspberry Pi avocado tests
cover tests/functional: Convert Raspberry Pi avocado tests
▶ 4/5 test_aarch64_raspi3.Aarch64Raspi3Machine.test_aarch64_raspi3_atf OK
4/5 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarch64_raspi3 OK 1.96s 1 subtests passed
▶ 5/5 test_aarch64_raspi4.Aarch64Raspi4Machine.test_arm_raspi4 OK
5/5 qemu:func-thorough+func-aarch64-thorough+thorough / func-aarch64-aarch64_raspi4 OK 5.19s 1 subtests passed
▶ 6/6 test_arm_raspi2.ArmRaspi2Machine.test_arm_raspi2_initrd OK
▶ 6/6 test_arm_raspi2.ArmRaspi2Machine.test_arm_raspi2_uart0 OK
6/6 qemu:func-thorough+func-arm-thorough+thorough / func-arm-arm_raspi2 OK 15.31s 2 subtests passed
Based-on: <[email protected]>
Philippe Mathieu-Daudé (4):
tests/functional: Add a class containing Linux kernel helpers tests/functional: Convert ARM Raspi2 avocado tests tests/functional: Convert Aarch64 Raspi3 avocado tests tests/functional: Convert Aarch64 Raspi4 avocado tests
MAINTAINERS | 3 + tests/avocado/boot_linux_console.py | 205 --------------------- tests/functional/meson.build | 6 + tests/functional/qemu_test/linux_kernel.py | 19 ++ tests/functional/test_aarch64_raspi3.py | 42 +++++ tests/functional/test_aarch64_raspi4.py | 106 +++++++++++ tests/functional/test_arm_raspi2.py | 103 +++++++++++ 7 files changed, 279 insertions(+), 205 deletions(-) create mode 100644 tests/functional/qemu_test/linux_kernel.py create mode 100755 tests/functional/test_aarch64_raspi3.py create mode 100755 tests/functional/test_aarch64_raspi4.py create mode 100755 tests/functional/test_arm_raspi2.py
Signature · 1 line
2.45.2
PATCH 1/4 tests/functional: Add a class containing Linux kernel helpers
Use the 'linux_kernel' namespace to provide common helpers to functional tests booting a Linux kernel.
--- tests/functional/qemu_test/linux_kernel.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tests/functional/qemu_test/linux_kernel.py
tests/functional/qemu_test/linux_kernel.py new file +19 -0
@@ -0,0 +1,19 @@ +# Linux kernel functional test helpers +# +# Copyright (c) 2024 Linaro Ltd. +# +# Author: +# Philippe Mathieu-Daudé <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from . import wait_for_console_pattern + +KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' + +KERNEL_PANIC_MESSAGE = 'Kernel panic - not syncing' + +def linux_kernel_wait_for_pattern(test, success_message): + wait_for_console_pattern(test, + success_message=success_message, + failure_message=KERNEL_PANIC_MESSAGE)
Signature · 1 line
2.45.2
Re: [PATCH 1/4] tests/functional: Add a class containing Linux kernel helpers
Quoted 25 lines · Philippe Mathieu-Daudé
Use the '
linux_kernel' namespace to provide common helpers to functional tests booting a Linux kernel.Suggested-by Thomas Huth <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/functional/qemu_test/linux_kernel.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)create mode 100644
tests/functional/qemu_test/linux_kernel.pytests/functional/qemu_test/linux_kernel.py new file +9
-0@@ -0,0 +1,19 @@ +# Linux kernel functional test helpers +# +# Copyright (c) 2024 Linaro Ltd. +# +# Author: +# Philippe Mathieu-Daudé <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0-or-later +
tests/functional/qemu_test/linux_kernel.py line 19
Quoted 10 lines
tests/functional/qemu_test/linux_kernel.py new file +10
-0+from . import wait_for_console_pattern + +KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' + +KERNEL_PANIC_MESSAGE = 'Kernel panic - not syncing' + +def linux_kernel_wait_for_pattern(test, success_message): + wait_for_console_pattern(test, + success_message=success_message, + failure_message=KERNEL_PANIC_MESSAGE)
I'd prefer to have the whole LinuxKernelTest class here (without the BootLinuxConsole class of course), that way the modifications that we have to do to the converted tests are definitely smaller when we don't have to change the "wait_for_console_pattern" lines everywhere. And it's also nicer if the variables are properly wrapped in a class.
Thomas
Re: [PATCH 1/4] tests/functional: Add a class containing Linux kernel helpers
Hi Thomas,
Quoted 30 lines · Thomas Huth
Quoted 29 lines · Philippe Mathieu-Daudé
Use the '
linux_kernel' namespace to provide common helpers to functional tests booting a Linux kernel.Suggested-by Thomas Huth <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
tests/functional/qemu_test/linux_kernel.py| 19 +++++++++++++++++++1 file changed, 19 insertions(+)create mode 100644
tests/functional/qemu_test/linux_kernel.pytests/functional/qemu_test/linux_kernel.py new file +13
-0@@ -0,0 +1,19 @@ +# Linux kernel functional test helpers +# +# Copyright (c) 2024 Linaro Ltd. +# +# Author: +# Philippe Mathieu-Daudé <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from . import wait_for_console_pattern + +KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' +
Quoted 8 lines
tests/functional/qemu_test/linux_kernel.py line 19
Quoted 6 lines
tests/functional/qemu_test/linux_kernel.py new file +6
-0+KERNEL_PANIC_MESSAGE = 'Kernel panic - not syncing' + +def linux_kernel_wait_for_pattern(test, success_message): + wait_for_console_pattern(test, + success_message=success_message, + failure_message=KERNEL_PANIC_MESSAGE)I'd prefer to have the whole LinuxKernelTest class here (without the BootLinuxConsole class of course), that way the modifications that we have to do to the converted tests are definitely smaller when we don't have to change the "
wait_for_console_pattern" lines everywhere. And it's also nicer if the variables are properly wrapped in a class.
I'm a bit confused by your comment. I exposed my view on LinuxKernelTest methods (which I don't see specific to this class) here:
https://lore.kernel.org/qemu-devel/[email protected]/
Could your request be implemented on top on this patch, as we go (as it is already helpful in its current state)? Otherwise I'll ask you to share a snippet of what you mean, or even better to post a v2 :)
Regards,
Phil.
Re: [PATCH 1/4] tests/functional: Add a class containing Linux kernel helpers
Quoted 42 lines · Philippe Mathieu-Daudé
Hi Thomas,
Quoted 30 lines · Thomas Huth
Quoted 29 lines · Philippe Mathieu-Daudé
Use the '
linux_kernel' namespace to provide common helpers to functional tests booting a Linux kernel.Suggested-by Thomas Huth <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
tests/functional/qemu_test/linux_kernel.py| 19 +++++++++++++++++++1 file changed, 19 insertions(+)create mode 100644
tests/functional/qemu_test/linux_kernel.pytests/functional/qemu_test/linux_kernel.py new file +13
-0@@ -0,0 +1,19 @@ +# Linux kernel functional test helpers +# +# Copyright (c) 2024 Linaro Ltd. +# +# Author: +# Philippe Mathieu-Daudé <[email protected]> +# +# SPDX-License-Identifier: GPL-2.0-or-later + +from . import wait_for_console_pattern + +KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' +Quoted 8 lines
tests/functional/qemu_test/linux_kernel.py line 19
Quoted 6 lines
tests/functional/qemu_test/linux_kernel.py new file +6
-0+KERNEL_PANIC_MESSAGE = 'Kernel panic - not syncing' + +def linux_kernel_wait_for_pattern(test, success_message): + wait_for_console_pattern(test, + success_message=success_message, + failure_message=KERNEL_PANIC_MESSAGE)I'd prefer to have the whole LinuxKernelTest class here (without the BootLinuxConsole class of course), that way the modifications that we have to do to the converted tests are definitely smaller when we don't have to change the "
wait_for_console_pattern" lines everywhere. And it's also nicer if the variables are properly wrapped in a class.
Quoted 7 lines
I'm a bit confused by your comment. I exposed my view on LinuxKernelTest methods (which I don't see specific to this class) here:
https://lore.kernel.org/qemu-devel/[email protected]/Could your request be implemented on top on this patch, as we go (as it is already helpful in its current state)? Otherwise I'll ask you to share a snippet of what you mean, or even better to post a v2 :)
I'll post a mini patch series (converting the Q800 test) in reply to your mail to show what I had in mind...
Thomas
cover tests/functional: Add LinuxKernelTest class and convert Q800 test
In reply to Philippe Mathieu-DaudéHere's how I'd suggest to convert the tests from tests/avocado/boot_linux_console.py :
Copy the whole LinuxKernelTest class (well, let's drop extract_from_rpm for now since it is completely unused), so we can copy the test code with only some few modifications (using the Q800 test as an example here).
Thomas Huth (2):
tests/functional: Add the LinuxKernelTest for testing the Linux boot
process
tests/functional: Convert the m68k Q800 Avocado test into a functional
test
MAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 24 ------------- tests/functional/meson.build | 3 +- tests/functional/qemu_test/__init__.py | 1 + tests/functional/qemu_test/linuxkernel.py | 41 +++++++++++++++++++++++ tests/functional/test_m68k_q800.py | 37 ++++++++++++++++++++ 6 files changed, 82 insertions(+), 25 deletions(-) create mode 100644 tests/functional/qemu_test/linuxkernel.py create mode 100755 tests/functional/test_m68k_q800.py
Signature · 1 line
2.46.0
PATCH 1/2 tests/functional: Add the LinuxKernelTest for testing the Linux boot process
Copy the LinuxKernelTest from tests/acceptance/boot_linux_console.py to be able to convert the related tests to the functional test framework in the following patches.
--- tests/functional/qemu_test/__init__.py | 1 + tests/functional/qemu_test/linuxkernel.py | 41 +++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 tests/functional/qemu_test/linuxkernel.py
tests/functional/qemu_test/__init__.py +1 -0
@@ -12,3 +12,4 @@ interrupt_interactive_console_until_pattern, wait_for_console_pattern, \ exec_command, exec_command_and_wait_for_pattern from .testcase import QemuSystemTest, QemuBaseTest +from .linuxkernel import LinuxKernelTest
tests/functional/qemu_test/linuxkernel.py new file +41 -0
41 lines not on this page · raw message
Signature · 1 line
2.46.0
PATCH 2/2 tests/functional: Convert the m68k Q800 Avocado test into a functional test
In reply to Thomas HuthJust had to update the asset checksum to use SHA256 instead of SHA1, but apart from that it is a pretty much straightforward conversion.
--- MAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 24 ------------------- tests/functional/meson.build | 3 ++- tests/functional/test_m68k_q800.py | 37 +++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 25 deletions(-) create mode 100755 tests/functional/test_m68k_q800.py
MAINTAINERS +1 -0
@@ -1309,6 +1309,7 @@ F: include/hw/m68k/q800-glue.h F: include/hw/misc/djmemc.h F: include/hw/misc/iosb.h F: include/hw/audio/asc.h +F: tests/functional/test_m68k_q800.py virt M: Laurent Vivier <[email protected]>
tests/avocado/boot_linux_console.py +0 -24
@@ -1325,30 +1325,6 @@ def test_alpha_clipper(self): console_pattern = 'Kernel command line: %s' % kernel_command_line self.wait_for_console_pattern(console_pattern) - def test_m68k_q800(self): - """ - :avocado: tags=arch:m68k - :avocado: tags=machine:q800 - """ - deb_url = ('https://snapshot.debian.org/archive/debian-ports' - '/20191021T083923Z/pool-m68k/main' - '/l/linux/kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb') - deb_hash = '044954bb9be4160a3ce81f8bc1b5e856b75cccd1' - deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) - kernel_path = self.extract_from_deb(deb_path, - '/boot/vmlinux-5.3.0-1-m68k') - - self.vm.set_console() - kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + - 'console=ttyS0 vga=off') - self.vm.add_args('-kernel', kernel_path, - '-append', kernel_command_line) - self.vm.launch() - console_pattern = 'Kernel command line: %s' % kernel_command_line - self.wait_for_console_pattern(console_pattern) - console_pattern = 'No filesystem could mount root' - self.wait_for_console_pattern(console_pattern) - def do_test_advcal_2018(self, day, tar_hash, kernel_name, console=0): tar_url = ('https://qemu-advcal.gitlab.io' '/qac-best-of-multiarch/download/day' + day + '.tar.xz')
tests/functional/meson.build +2 -1
@@ -40,7 +40,8 @@ tests_loongarch64_thorough = [ ] tests_m68k_thorough = [ - 'm68k_nextcube' + 'm68k_nextcube', + 'm68k_q800', ] tests_microblaze_thorough = [
tests/functional/test_m68k_q800.py new file +37 -0
@@ -0,0 +1,37 @@ +#!/usr/bin/env python3 +# +# Functional test for testing the q800 m68k machine +# +# 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 LinuxKernelTest, Asset + +class Q800MachineTest(LinuxKernelTest): + + ASSET_KERNEL = Asset( + ('https://snapshot.debian.org/' + 'archive/debian-ports/20191021T083923Z/pool-m68k/main/l/linux/' + 'kernel-image-5.3.0-1-m68k-di_5.3.7-1_m68k.udeb'), + '949e50d74d4b9bc15d26c06d402717b7a4c0e32ff8100014f5930d8024de7b73') + + def test_m68k_q800(self): + self.set_machine('q800') + + deb_path = self.ASSET_KERNEL.fetch() + kernel_path = self.extract_from_deb(deb_path, + '/boot/vmlinux-5.3.0-1-m68k') + + self.vm.set_console() + kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + + 'console=ttyS0 vga=off') + self.vm.add_args('-kernel', kernel_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern = 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) + console_pattern = 'No filesystem could mount root' + self.wait_for_console_pattern(console_pattern) + +if __name__ == '__main__': + LinuxKernelTest.main()
Signature · 1 line
2.46.0
PATCH 2/4 tests/functional: Convert ARM Raspi2 avocado tests
In reply to Philippe Mathieu-DaudéStraight forward conversion. Update the SHA1 hashes to SHA256 hashes since SHA1 should not be used anymore nowadays.
--- MAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 85 ----------------------- tests/functional/meson.build | 1 + tests/functional/test_arm_raspi2.py | 103 ++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 85 deletions(-) create mode 100755 tests/functional/test_arm_raspi2.py
MAINTAINERS +1 -0
@@ -910,6 +910,7 @@ F: hw/*/bcm283* F: include/hw/arm/rasp* F: include/hw/*/bcm283* F: docs/system/arm/raspi.rst +F: tests/functional/test_arm_raspi2.py Real View M: Peter Maydell <[email protected]>
tests/avocado/boot_linux_console.py +0 -85
91 lines not on this page · raw message
tests/functional/meson.build +1 -0
@@ -29,6 +29,7 @@ tests_generic = [ tests_arm_thorough = [ 'arm_canona1100', 'arm_n8x0', + 'arm_raspi2', ] tests_avr_thorough = [
tests/functional/test_arm_raspi2.py new file +103 -0
103 lines not on this page · raw message
Signature · 1 line
2.45.2
PATCH 3/4 tests/functional: Convert Aarch64 Raspi3 avocado tests
In reply to Philippe Mathieu-DaudéStraight forward conversion. Update the SHA1 hashes to SHA256 hashes since SHA1 should not be used anymore nowadays.
--- MAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 23 -------------- tests/functional/meson.build | 4 +++ tests/functional/test_aarch64_raspi3.py | 42 +++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 23 deletions(-) create mode 100755 tests/functional/test_aarch64_raspi3.py
MAINTAINERS +1 -0
@@ -911,6 +911,7 @@ F: include/hw/arm/rasp* F: include/hw/*/bcm283* F: docs/system/arm/raspi.rst F: tests/functional/test_arm_raspi2.py +F: tests/functional/test_aarch64_raspi3.py Real View M: Peter Maydell <[email protected]>
tests/avocado/boot_linux_console.py +0 -23
@@ -979,29 +979,6 @@ def test_arm_orangepi_uboot_netbsd9(self): # Wait for user-space wait_for_console_pattern(self, 'Starting root file system check') - def test_aarch64_raspi3_atf(self): - """ - :avocado: tags=accel:tcg - :avocado: tags=arch:aarch64 - :avocado: tags=machine:raspi3b - :avocado: tags=cpu:cortex-a53 - :avocado: tags=device:pl011 - :avocado: tags=atf - """ - zip_url = ('https://github.com/pbatard/RPi3/releases/download/' - 'v1.15/RPi3_UEFI_Firmware_v1.15.zip') - zip_hash = '74b3bd0de92683cadb14e008a7575e1d0c3cafb9' - zip_path = self.fetch_asset(zip_url, asset_hash=zip_hash) - - archive.extract(zip_path, self.workdir) - efi_fd = os.path.join(self.workdir, 'RPI_EFI.fd') - - self.vm.set_console(console_index=1) - self.vm.add_args('-nodefaults', - '-device', 'loader,file=%s,force-raw=true' % efi_fd) - self.vm.launch() - self.wait_for_console_pattern('version UEFI Firmware v1.15') - def test_alpha_clipper(self): """ :avocado: tags=arch:alpha
tests/functional/meson.build +4 -0
@@ -26,6 +26,10 @@ tests_generic = [ 'version', ] +tests_aarch64_thorough = [ + 'aarch64_raspi3', +] + tests_arm_thorough = [ 'arm_canona1100', 'arm_n8x0',
tests/functional/test_aarch64_raspi3.py new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.45.2
PATCH 4/4 tests/functional: Convert Aarch64 Raspi4 avocado tests
In reply to Philippe Mathieu-DaudéStraight forward conversion. Update the SHA1 hashes to SHA256 hashes since SHA1 should not be used anymore nowadays.
--- MAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 97 ---------------------- tests/functional/meson.build | 1 + tests/functional/test_aarch64_raspi4.py | 106 ++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 97 deletions(-) create mode 100755 tests/functional/test_aarch64_raspi4.py
MAINTAINERS +1 -0
@@ -912,6 +912,7 @@ F: include/hw/*/bcm283* F: docs/system/arm/raspi.rst F: tests/functional/test_arm_raspi2.py F: tests/functional/test_aarch64_raspi3.py +F: tests/functional/test_aarch64_raspi4.py Real View M: Peter Maydell <[email protected]>
tests/avocado/boot_linux_console.py +0 -97
103 lines not on this page · raw message
tests/functional/meson.build +1 -0
@@ -28,6 +28,7 @@ tests_generic = [ tests_aarch64_thorough = [ 'aarch64_raspi3', + 'aarch64_raspi4', ] tests_arm_thorough = [
tests/functional/test_aarch64_raspi4.py new file +106 -0
106 lines not on this page · raw message
Signature · 1 line
2.45.2