Convert the BananaPi and OrangePi Avacodo tests
cover Convert the BananaPi and OrangePi Avacodo tests
Some of the URLs in the Avocado tests stopped working since the original assets have been removed from the servers or moved location, see:
Since we are currently in progress of converting the Avocado tests to the new functional framework, this is a good opportunity to convert these tests and adjust the URLs (and hashsums) along the way to make these tests work again.
Thomas Huth (2):
tests/functional: Convert BananaPi tests to the functional framework tests/functional: Convert the OrangePi tests to the functional
framework
MAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 411 -------------------------- tests/functional/meson.build | 4 + tests/functional/qemu_test/utils.py | 21 ++ tests/functional/test_arm_bpim2u.py | 206 +++++++++++++ tests/functional/test_arm_orangepi.py | 270 +++++++++++++++++ 6 files changed, 502 insertions(+), 411 deletions(-) create mode 100755 tests/functional/test_arm_bpim2u.py create mode 100755 tests/functional/test_arm_orangepi.py
Signature · 1 line
2.47.0
PATCH 1/2 tests/functional: Convert BananaPi tests to the functional framework
Move the BananaPi tests from tests/avocado/boot_linux_console.py into a new file dedicated for Banana Pi tests in the functional framework. Update the hash sums of the assets to sha256 along the way and fix the broken link for the buildroot image from storage.kernelci.org.
(Note: The test_arm_bpim2u_openwrt_22_03_3 test is currently broken due to a regression in commit 4c2c047469 ("target/arm: Fix usage of MMU indexes when EL3 is AArch32") - it works if that commit gets reverted)
--- tests/avocado/boot_linux_console.py | 176 ------------------------ tests/functional/meson.build | 2 + tests/functional/qemu_test/utils.py | 21 +++ tests/functional/test_arm_bpim2u.py | 206 ++++++++++++++++++++++++++++ 4 files changed, 229 insertions(+), 176 deletions(-) create mode 100755 tests/functional/test_arm_bpim2u.py
tests/avocado/boot_linux_console.py +0 -176
@@ -471,182 +471,6 @@ def test_arm_quanta_gsj_initrd(self): self.wait_for_console_pattern( 'Give root password for system maintenance') - def test_arm_bpim2u(self): - """ - :avocado: tags=arch:arm - :avocado: tags=machine:bpim2u - :avocado: tags=accel:tcg - """ - deb_url = ('https://apt.armbian.com/pool/main/l/' - 'linux-6.6.16/linux-image-current-sunxi_24.2.1_armhf__6.6.16-Seb3e-D6b4a-P2359-Ce96bHfe66-HK01ba-V014b-B067e-R448a.deb') - deb_hash = 'f7c3c8c5432f765445dc6e7eab02f3bbe668256b' - deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) - kernel_path = self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-sunxi') - dtb_path = ('/usr/lib/linux-image-6.6.16-current-sunxi/' - 'sun8i-r40-bananapi-m2-ultra.dtb') - dtb_path = self.extract_from_deb(deb_path, dtb_path) - - self.vm.set_console() - kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + - 'console=ttyS0,115200n8 ' - 'earlycon=uart,mmio32,0x1c28000') - self.vm.add_args('-kernel', kernel_path, - '-dtb', dtb_path, - '-append', kernel_command_line) - self.vm.launch() - console_pattern = 'Kernel command line: %s' % kernel_command_line - self.wait_for_console_pattern(console_pattern) - - def test_arm_bpim2u_initrd(self): - """ - :avocado: tags=arch:arm - :avocado: tags=accel:tcg - :avocado: tags=machine:bpim2u - """ - deb_url = ('https://apt.armbian.com/pool/main/l/' - 'linux-6.6.16/linux-image-current-sunxi_24.2.1_armhf__6.6.16-Seb3e-D6b4a-P2359-Ce96bHfe66-HK01ba-V014b-B067e-R448a.deb') - deb_hash = 'f7c3c8c5432f765445dc6e7eab02f3bbe668256b' - deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) - kernel_path = self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-sunxi') - dtb_path = ('/usr/lib/linux-image-6.6.16-current-sunxi/' - 'sun8i-r40-bananapi-m2-ultra.dtb') - dtb_path = self.extract_from_deb(deb_path, dtb_path) - initrd_url = ('https://github.com/groeck/linux-build-test/raw/' - '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' - 'arm/rootfs-armv7a.cpio.gz') - initrd_hash = '604b2e45cdf35045846b8bbfbf2129b1891bdc9c' - initrd_path_gz = self.fetch_asset(initrd_url, asset_hash=initrd_hash) - initrd_path = os.path.join(self.workdir, 'rootfs.cpio') - archive.gzip_uncompress(initrd_path_gz, initrd_path) - - self.vm.set_console() - kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + - 'console=ttyS0,115200 ' - 'panic=-1 noreboot') - self.vm.add_args('-kernel', kernel_path, - '-dtb', dtb_path, - '-initrd', initrd_path, - '-append', kernel_command_line, - '-no-reboot') - self.vm.launch() - self.wait_for_console_pattern('Boot successful.') - - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'Allwinner sun8i Family') - exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', - 'system-control@1c00000') - exec_command_and_wait_for_pattern(self, 'reboot', - 'reboot: Restarting system') - # Wait for VM to shut down gracefully - self.vm.wait() - - def test_arm_bpim2u_gmac(self): - """ - :avocado: tags=arch:arm - :avocado: tags=accel:tcg - :avocado: tags=machine:bpim2u - :avocado: tags=device:sd - """ - self.require_netdev('user') - - deb_url = ('https://apt.armbian.com/pool/main/l/' - 'linux-6.6.16/linux-image-current-sunxi_24.2.1_armhf__6.6.16-Seb3e-D6b4a-P2359-Ce96bHfe66-HK01ba-V014b-B067e-R448a.deb') - deb_hash = 'f7c3c8c5432f765445dc6e7eab02f3bbe668256b' - deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash) - kernel_path = self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-sunxi') - dtb_path = ('/usr/lib/linux-image-6.6.16-current-sunxi/' - 'sun8i-r40-bananapi-m2-ultra.dtb') - dtb_path = self.extract_from_deb(deb_path, dtb_path) - rootfs_url = ('http://storage.kernelci.org/images/rootfs/buildroot/' - 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') - rootfs_hash = 'fae32f337c7b87547b10f42599acf109da8b6d9a' - rootfs_path_xz = self.fetch_asset(rootfs_url, asset_hash=rootfs_hash) - rootfs_path = os.path.join(self.workdir, 'rootfs.cpio') - archive.lzma_uncompress(rootfs_path_xz, rootfs_path) - image_pow2ceil_expand(rootfs_path) - - self.vm.set_console() - kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + - 'console=ttyS0,115200 ' - 'root=b300 rootwait rw ' - 'panic=-1 noreboot') - self.vm.add_args('-kernel', kernel_path, - '-dtb', dtb_path, - '-drive', 'file=' + rootfs_path + ',if=sd,format=raw', - '-net', 'nic,model=gmac,netdev=host_gmac', - '-netdev', 'user,id=host_gmac', - '-append', kernel_command_line, - '-no-reboot') - self.vm.launch() - shell_ready = "/bin/sh: can't access tty; job control turned off" - self.wait_for_console_pattern(shell_ready) - - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'Allwinner sun8i Family') - exec_command_and_wait_for_pattern(self, 'cat /proc/partitions', - 'mmcblk') - exec_command_and_wait_for_pattern(self, 'ifconfig eth0 up', - 'eth0: Link is Up') - exec_command_and_wait_for_pattern(self, 'udhcpc eth0', - 'udhcpc: lease of 10.0.2.15 obtained') - exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', - '3 packets transmitted, 3 packets received, 0% packet loss') - exec_command_and_wait_for_pattern(self, 'reboot', - 'reboot: Restarting system') - # Wait for VM to shut down gracefully - self.vm.wait() - - @skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited') - def test_arm_bpim2u_openwrt_22_03_3(self): - """ - :avocado: tags=arch:arm - :avocado: tags=machine:bpim2u - :avocado: tags=device:sd - """ - - # This test download a 8.9 MiB compressed image and expand it - # to 127 MiB. - image_url = ('https://downloads.openwrt.org/releases/22.03.3/targets/' - 'sunxi/cortexa7/openwrt-22.03.3-sunxi-cortexa7-' - 'sinovoip_bananapi-m2-ultra-ext4-sdcard.img.gz') - image_hash = ('5b41b4e11423e562c6011640f9a7cd3b' - 'dd0a3d42b83430f7caa70a432e6cd82c') - image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash, - algorithm='sha256') - image_path = archive.extract(image_path_gz, self.workdir) - image_pow2ceil_expand(image_path) - - self.vm.set_console() - self.vm.add_args('-drive', 'file=' + image_path + ',if=sd,format=raw', - '-nic', 'user', - '-no-reboot') - self.vm.launch() - - kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE + - 'usbcore.nousb ' - 'noreboot') - - self.wait_for_console_pattern('U-Boot SPL') - - interrupt_interactive_console_until_pattern( - self, 'Hit any key to stop autoboot:', '=>') - exec_command_and_wait_for_pattern(self, "setenv extraargs '" + - kernel_command_line + "'", '=>') - exec_command_and_wait_for_pattern(self, 'boot', 'Starting kernel ...'); - - self.wait_for_console_pattern( - 'Please press Enter to activate this console.') - - exec_command_and_wait_for_pattern(self, ' ', 'root@') - - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'Allwinner sun8i Family') - exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', - 'system-control@1c00000') - def test_arm_orangepi(self): """ :avocado: tags=arch:arm
tests/functional/meson.build +2 -0
@@ -15,6 +15,7 @@ test_timeouts = { 'aarch64_sbsaref' : 600, 'aarch64_virt' : 360, 'acpi_bits' : 240, + 'arm_bpim2u' : 360, 'arm_raspi2' : 120, 'arm_tuxrun' : 120, 'mips_malta' : 120,
@@ -52,6 +53,7 @@ tests_alpha_system_thorough = [ ] tests_arm_system_thorough = [ + 'arm_bpim2u', 'arm_canona1100', 'arm_integratorcp', 'arm_raspi2',
tests/functional/qemu_test/utils.py +21 -0
@@ -15,6 +15,27 @@ import subprocess import tarfile +""" +Round up to next power of 2 +""" +def pow2ceil(x): + return 1 if x == 0 else 2**(x - 1).bit_length() + +def file_truncate(path, size): + if size != os.path.getsize(path): + with open(path, 'ab+') as fd: + fd.truncate(size) + +""" +Expand file size to next power of 2 +""" +def image_pow2ceil_expand(path): + size = os.path.getsize(path) + size_aligned = pow2ceil(size) + if size != size_aligned: + with open(path, 'ab+') as fd: + fd.truncate(size_aligned) + def archive_extract(archive, dest_dir, member=None): with tarfile.open(archive) as tf: if hasattr(tarfile, 'data_filter'):
tests/functional/test_arm_bpim2u.py new file +206 -0
206 lines not on this page · raw message
Signature · 1 line
2.47.0
PATCH 2/2 tests/functional: Convert the OrangePi tests to the functional framework
In reply to Thomas HuthMove the OrangePi tests from tests/avocado/boot_linux_console.py into a new file dedicated for OrangePi tests in the functional framework and update the hash sums of the assets to sha256 along the way. For the buildroot image and the Armbian image, we've got to switch to a newer version since the old images have been removed from the server, and the NetBSD image has been moved to the archive, so we need to update this URL as well.
--- MAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 235 ---------------------- tests/functional/meson.build | 2 + tests/functional/test_arm_orangepi.py | 270 ++++++++++++++++++++++++++ 4 files changed, 273 insertions(+), 235 deletions(-) create mode 100755 tests/functional/test_arm_orangepi.py
MAINTAINERS +1 -0
@@ -640,6 +640,7 @@ F: hw/*/allwinner-h3* F: include/hw/*/allwinner-h3* F: hw/arm/orangepi.c F: docs/system/arm/orangepi.rst +F: tests/functional/test_arm_orangepi.py ARM PrimeCell and CMSDK devices M: Peter Maydell <[email protected]>
tests/avocado/boot_linux_console.py +0 -235
241 lines not on this page · raw message
tests/functional/meson.build +2 -0
@@ -16,6 +16,7 @@ test_timeouts = { 'aarch64_virt' : 360, 'acpi_bits' : 240, 'arm_bpim2u' : 360, + 'arm_orangepi' : 540, 'arm_raspi2' : 120, 'arm_tuxrun' : 120, 'mips_malta' : 120,
@@ -56,6 +57,7 @@ tests_arm_system_thorough = [ 'arm_bpim2u', 'arm_canona1100', 'arm_integratorcp', + 'arm_orangepi', 'arm_raspi2', 'arm_vexpress', 'arm_tuxrun',
tests/functional/test_arm_orangepi.py new file +270 -0
270 lines not on this page · raw message
Signature · 1 line
2.47.0
Hi Thomas,
Quoted 23 lines · Thomas Huth
Some of the URLs in the Avocado tests stopped working since the original assets have been removed from the servers or moved location, see:
Since we are currently in progress of converting the Avocado tests to the new functional framework, this is a good opportunity to convert these tests and adjust the URLs (and hashsums) along the way to make these tests work again.
Thomas Huth (2):
tests/functional: Convert BananaPi tests to the functional framework tests/functional: Convert the OrangePi tests to the functional
frameworkMAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 411 -------------------------- tests/functional/meson.build | 4 + tests/functional/qemu_test/utils.py | 21 ++ tests/functional/test_arm_bpim2u.py | 206 +++++++++++++ tests/functional/test_arm_orangepi.py | 270 +++++++++++++++++ 6 files changed, 502 insertions(+), 411 deletions(-)
Quoted 3 lines
create mode 100755
tests/functional/test_arm_bpim2u.pycreate mode 100755tests/functional/test_arm_orangepi.py
I have a general question regarding tests in QEMU.
Is the current goal to convert all avocado tests to functional ones, and then remove avocado from codebase?
Thanks,
Pierrick
Quoted 30 lines · Pierrick Bouvier
Hi Thomas,
Quoted 22 lines · Thomas Huth
Some of the URLs in the Avocado tests stopped working since the original assets have been removed from the servers or moved location, see:
https://lore.kernel.org/qemu-devel/CACPK8Xc=jsz5iT_WR7s- [email protected]/
Since we are currently in progress of converting the Avocado tests to the new functional framework, this is a good opportunity to convert these tests and adjust the URLs (and hashsums) along the way to make these tests work again.
Thomas Huth (2):
tests/functional: Convert BananaPi tests to the functional framework tests/functional: Convert the OrangePi tests to the functional frameworkMAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 411 -------------------------- tests/functional/meson.build | 4 + tests/functional/qemu_test/utils.py | 21 ++ tests/functional/test_arm_bpim2u.py | 206 +++++++++++++
tests/functional/test_arm_orangepi.py| 270 +++++++++++++++++Quoted 4 lines
6 files changed, 502 insertions(+), 411 deletions(-)create mode 100755
tests/functional/test_arm_bpim2u.pycreate mode 100755tests/functional/test_arm_orangepi.py
Quoted 2 lines
I have a general question regarding tests in QEMU.
Is the current goal to convert all avocado tests to functional ones, and then remove avocado from codebase?
Yes, I think that's the best way to move forward. It's weird to have two test runners in QEMU for the tests, and since we're already using the meson test runner for almost everything else, we should continue this transition.
Thomas
Quoted 32 lines · Thomas Huth
Quoted 31 lines · Pierrick Bouvier
Hi Thomas,
Quoted 27 lines · Thomas Huth
Some of the URLs in the Avocado tests stopped working since the original assets have been removed from the servers or moved location, see:
https://lore.kernel.org/qemu-devel/CACPK8Xc=jsz5iT_WR7s-
[email protected]/Since we are currently in progress of converting the Avocado tests to the new functional framework, this is a good opportunity to convert these tests and adjust the URLs (and hashsums) along the way to make these tests work again.
Thomas Huth (2):
tests/functional: Convert BananaPi tests to the functional framework tests/functional: Convert the OrangePi tests to the functional frameworkMAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 411 -------------------------- tests/functional/meson.build | 4 + tests/functional/qemu_test/utils.py | 21 ++ tests/functional/test_arm_bpim2u.py | 206 +++++++++++++ tests/functional/test_arm_orangepi.py | 270 +++++++++++++++++ 6 files changed, 502 insertions(+), 411 deletions(-)create mode 100755
tests/functional/test_arm_bpim2u.pycreate mode 100755tests/functional/test_arm_orangepi.py
Quoted 8 lines
Quoted 3 lines
I have a general question regarding tests in QEMU.
Is the current goal to convert all avocado tests to functional ones, and then remove avocado from codebase?Yes, I think that's the best way to move forward. It's weird to have two test runners in QEMU for the tests, and since we're already using the meson test runner for almost everything else, we should continue this transition.
Sounds good. In my experience, it's a bit annoying to not be able to precache easily assets for avocado tests.
Quoted 2 lines
Thomas