mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-18 15:42:09 -06:00
tests/functional: Convert the OrangePi tests to the functional framework
Move 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. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-ID: <20241029092440.25021-3-thuth@redhat.com>
This commit is contained in:
parent
f7d6b77220
commit
380f7268b7
4 changed files with 273 additions and 235 deletions
|
@ -471,241 +471,6 @@ class BootLinuxConsole(LinuxKernelTest):
|
|||
self.wait_for_console_pattern(
|
||||
'Give root password for system maintenance')
|
||||
|
||||
def test_arm_orangepi(self):
|
||||
"""
|
||||
:avocado: tags=arch:arm
|
||||
:avocado: tags=machine:orangepi-pc
|
||||
: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-h3-orangepi-pc.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_orangepi_initrd(self):
|
||||
"""
|
||||
:avocado: tags=arch:arm
|
||||
:avocado: tags=accel:tcg
|
||||
:avocado: tags=machine:orangepi-pc
|
||||
"""
|
||||
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-h3-orangepi-pc.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_orangepi_sd(self):
|
||||
"""
|
||||
:avocado: tags=arch:arm
|
||||
:avocado: tags=accel:tcg
|
||||
:avocado: tags=machine:orangepi-pc
|
||||
: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-h3-orangepi-pc.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=/dev/mmcblk0 rootwait rw '
|
||||
'panic=-1 noreboot')
|
||||
self.vm.add_args('-kernel', kernel_path,
|
||||
'-dtb', dtb_path,
|
||||
'-drive', 'file=' + rootfs_path + ',if=sd,format=raw',
|
||||
'-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',
|
||||
'mmcblk0')
|
||||
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_orangepi_bionic_20_08(self):
|
||||
"""
|
||||
:avocado: tags=arch:arm
|
||||
:avocado: tags=machine:orangepi-pc
|
||||
:avocado: tags=device:sd
|
||||
"""
|
||||
|
||||
# This test download a 275 MiB compressed image and expand it
|
||||
# to 1036 MiB, but the underlying filesystem is 1552 MiB...
|
||||
# As we expand it to 2 GiB we are safe.
|
||||
|
||||
image_url = ('https://archive.armbian.com/orangepipc/archive/'
|
||||
'Armbian_20.08.1_Orangepipc_bionic_current_5.8.5.img.xz')
|
||||
image_hash = ('b4d6775f5673486329e45a0586bf06b6'
|
||||
'dbe792199fd182ac6b9c7bb6c7d3e6dd')
|
||||
image_path_xz = self.fetch_asset(image_url, asset_hash=image_hash,
|
||||
algorithm='sha256')
|
||||
image_path = archive.extract(image_path_xz, 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 +
|
||||
'console=ttyS0,115200 '
|
||||
'loglevel=7 '
|
||||
'nosmp '
|
||||
'systemd.default_timeout_start_sec=9000 '
|
||||
'systemd.mask=armbian-zram-config.service '
|
||||
'systemd.mask=armbian-ramlog.service')
|
||||
|
||||
self.wait_for_console_pattern('U-Boot SPL')
|
||||
self.wait_for_console_pattern('Autoboot in ')
|
||||
exec_command_and_wait_for_pattern(self, ' ', '=>')
|
||||
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('systemd[1]: Set hostname ' +
|
||||
'to <orangepipc>')
|
||||
self.wait_for_console_pattern('Starting Load Kernel Modules...')
|
||||
|
||||
@skipUnless(os.getenv('AVOCADO_ALLOW_LARGE_STORAGE'), 'storage limited')
|
||||
def test_arm_orangepi_uboot_netbsd9(self):
|
||||
"""
|
||||
:avocado: tags=arch:arm
|
||||
:avocado: tags=machine:orangepi-pc
|
||||
:avocado: tags=device:sd
|
||||
:avocado: tags=os:netbsd
|
||||
"""
|
||||
# This test download a 304MB compressed image and expand it to 2GB
|
||||
deb_url = ('http://snapshot.debian.org/archive/debian/'
|
||||
'20200108T145233Z/pool/main/u/u-boot/'
|
||||
'u-boot-sunxi_2020.01%2Bdfsg-1_armhf.deb')
|
||||
deb_hash = 'f67f404a80753ca3d1258f13e38f2b060e13db99'
|
||||
deb_path = self.fetch_asset(deb_url, asset_hash=deb_hash)
|
||||
# We use the common OrangePi PC 'plus' build of U-Boot for our secondary
|
||||
# program loader (SPL). We will then set the path to the more specific
|
||||
# OrangePi "PC" device tree blob with 'setenv fdtfile' in U-Boot prompt,
|
||||
# before to boot NetBSD.
|
||||
uboot_path = '/usr/lib/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin'
|
||||
uboot_path = self.extract_from_deb(deb_path, uboot_path)
|
||||
image_url = ('https://cdn.netbsd.org/pub/NetBSD/NetBSD-9.0/'
|
||||
'evbarm-earmv7hf/binary/gzimg/armv7.img.gz')
|
||||
image_hash = '2babb29d36d8360adcb39c09e31060945259917a'
|
||||
image_path_gz = self.fetch_asset(image_url, asset_hash=image_hash)
|
||||
image_path = os.path.join(self.workdir, 'armv7.img')
|
||||
archive.gzip_uncompress(image_path_gz, image_path)
|
||||
image_pow2ceil_expand(image_path)
|
||||
image_drive_args = 'if=sd,format=raw,snapshot=on,file=' + image_path
|
||||
|
||||
# dd if=u-boot-sunxi-with-spl.bin of=armv7.img bs=1K seek=8 conv=notrunc
|
||||
with open(uboot_path, 'rb') as f_in:
|
||||
with open(image_path, 'r+b') as f_out:
|
||||
f_out.seek(8 * 1024)
|
||||
shutil.copyfileobj(f_in, f_out)
|
||||
|
||||
self.vm.set_console()
|
||||
self.vm.add_args('-nic', 'user',
|
||||
'-drive', image_drive_args,
|
||||
'-global', 'allwinner-rtc.base-year=2000',
|
||||
'-no-reboot')
|
||||
self.vm.launch()
|
||||
wait_for_console_pattern(self, 'U-Boot 2020.01+dfsg-1')
|
||||
interrupt_interactive_console_until_pattern(self,
|
||||
'Hit any key to stop autoboot:',
|
||||
'switch to partitions #0, OK')
|
||||
|
||||
exec_command_and_wait_for_pattern(self, '', '=>')
|
||||
cmd = 'setenv bootargs root=ld0a'
|
||||
exec_command_and_wait_for_pattern(self, cmd, '=>')
|
||||
cmd = 'setenv kernel netbsd-GENERIC.ub'
|
||||
exec_command_and_wait_for_pattern(self, cmd, '=>')
|
||||
cmd = 'setenv fdtfile dtb/sun8i-h3-orangepi-pc.dtb'
|
||||
exec_command_and_wait_for_pattern(self, cmd, '=>')
|
||||
cmd = ("setenv bootcmd 'fatload mmc 0:1 ${kernel_addr_r} ${kernel}; "
|
||||
"fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}; "
|
||||
"fdt addr ${fdt_addr_r}; "
|
||||
"bootm ${kernel_addr_r} - ${fdt_addr_r}'")
|
||||
exec_command_and_wait_for_pattern(self, cmd, '=>')
|
||||
|
||||
exec_command_and_wait_for_pattern(self, 'boot',
|
||||
'Booting kernel from Legacy Image')
|
||||
wait_for_console_pattern(self, 'Starting kernel ...')
|
||||
wait_for_console_pattern(self, 'NetBSD 9.0 (GENERIC)')
|
||||
# Wait for user-space
|
||||
wait_for_console_pattern(self, 'Starting root file system check')
|
||||
|
||||
def test_arm_ast2600_debian(self):
|
||||
"""
|
||||
:avocado: tags=arch:arm
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue