From nobody Sat Nov 23 20:04:36 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1730397082; cv=none; d=zohomail.com; s=zohoarc; b=Bi5Nkh7hwC7hj5+bd/eXzO1ZMeN+hWtJkJROQWHgAVXVs4bAXJxdjeJwxV8d+o39mFv0SqY1xACVd3GrVfCGwsz1nAdOLmj54KrUdGgFLVPj3VN4QqXQKHXW5H3YnKkwguQtauXdZl4LLIJuvGWbPqRejtOH3nJS2LVoxQYsX/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730397082; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XufSQaaoENVQYpLtOJ6oHxX5MXy2qIHq5uDlcGp9YDg=; b=eTz0154C5ihm1Re38IMwv3UJY27zknqR60u9jbJ/OvVz07lH1Z9HLNyIw07V6HqlZj0VC0bbGDdhMoCeIz8j8eNlotkIv0F+0oUavL2weD3rLBwqykOzWKl5HBDdilFOAXpLUOg7hvPc66j+25Rc+ULFDbCeWZMYBJ9GCC5klDU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1730397082577148.17445980204377; Thu, 31 Oct 2024 10:51:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6ZIp-0007J7-BD; Thu, 31 Oct 2024 13:49:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6ZIM-0006xg-1f for qemu-devel@nongnu.org; Thu, 31 Oct 2024 13:49:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6ZIJ-0006cq-Bq for qemu-devel@nongnu.org; Thu, 31 Oct 2024 13:49:17 -0400 Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-83-GNCk0KmrNv2GUbMpgYqlcg-1; Thu, 31 Oct 2024 13:49:12 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1F16D1955BCB; Thu, 31 Oct 2024 17:49:12 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.53]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C1B75300018D; Thu, 31 Oct 2024 17:49:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730396954; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XufSQaaoENVQYpLtOJ6oHxX5MXy2qIHq5uDlcGp9YDg=; b=KCeLrBfXwQyLToopOpiNTGgU107hy72quWGmqRR2fYB9g/rO0WbJpy1snbe0nwK+QWgQUt lGbqq2TaUl6/DFp6WraFYGGx0XpJ1r1/+mIw2J0pDA4OM3CTeTZbSWT7wZoq2XE5+gmip5 /RF3dSEqT74aLDREfPnLvSAA5DxX7xI= X-MC-Unique: GNCk0KmrNv2GUbMpgYqlcg-1 From: Thomas Huth To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 12/14] tests/functional: Convert BananaPi tests to the functional framework Date: Thu, 31 Oct 2024 18:48:30 +0100 Message-ID: <20241031174832.6574-13-thuth@redhat.com> In-Reply-To: <20241031174832.6574-1-thuth@redhat.com> References: <20241031174832.6574-1-thuth@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -24 X-Spam_score: -2.5 X-Spam_bar: -- X-Spam_report: (-2.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.366, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1730397084786116600 Content-Type: text/plain; charset="utf-8" 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) Signed-off-by: Thomas Huth Message-ID: <20241029092440.25021-2-thuth@redhat.com> --- 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 diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux= _console.py index 23d1b3587b..d05abf0d1a 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -471,182 +471,6 @@ def test_arm_quanta_gsj_initrd(self): self.wait_for_console_pattern( 'Give root password for system maintenance') =20 - def test_arm_bpim2u(self): - """ - :avocado: tags=3Darch:arm - :avocado: tags=3Dmachine:bpim2u - :avocado: tags=3Daccel:tcg - """ - deb_url =3D ('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 =3D 'f7c3c8c5432f765445dc6e7eab02f3bbe668256b' - deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') - dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' - 'sun8i-r40-bananapi-m2-ultra.dtb') - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) - - self.vm.set_console() - kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + - 'console=3DttyS0,115200n8 ' - 'earlycon=3Duart,mmio32,0x1c28000') - self.vm.add_args('-kernel', kernel_path, - '-dtb', dtb_path, - '-append', kernel_command_line) - self.vm.launch() - console_pattern =3D 'Kernel command line: %s' % kernel_command_line - self.wait_for_console_pattern(console_pattern) - - def test_arm_bpim2u_initrd(self): - """ - :avocado: tags=3Darch:arm - :avocado: tags=3Daccel:tcg - :avocado: tags=3Dmachine:bpim2u - """ - deb_url =3D ('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 =3D 'f7c3c8c5432f765445dc6e7eab02f3bbe668256b' - deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') - dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' - 'sun8i-r40-bananapi-m2-ultra.dtb') - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) - initrd_url =3D ('https://github.com/groeck/linux-build-test/raw/' - '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' - 'arm/rootfs-armv7a.cpio.gz') - initrd_hash =3D '604b2e45cdf35045846b8bbfbf2129b1891bdc9c' - initrd_path_gz =3D self.fetch_asset(initrd_url, asset_hash=3Dinitr= d_hash) - initrd_path =3D os.path.join(self.workdir, 'rootfs.cpio') - archive.gzip_uncompress(initrd_path_gz, initrd_path) - - self.vm.set_console() - kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + - 'console=3DttyS0,115200 ' - 'panic=3D-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=3Darch:arm - :avocado: tags=3Daccel:tcg - :avocado: tags=3Dmachine:bpim2u - :avocado: tags=3Ddevice:sd - """ - self.require_netdev('user') - - deb_url =3D ('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 =3D 'f7c3c8c5432f765445dc6e7eab02f3bbe668256b' - deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) - kernel_path =3D self.extract_from_deb(deb_path, - '/boot/vmlinuz-6.6.16-current-= sunxi') - dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' - 'sun8i-r40-bananapi-m2-ultra.dtb') - dtb_path =3D self.extract_from_deb(deb_path, dtb_path) - rootfs_url =3D ('http://storage.kernelci.org/images/rootfs/buildro= ot/' - 'buildroot-baseline/20221116.0/armel/rootfs.ext2.xz') - rootfs_hash =3D 'fae32f337c7b87547b10f42599acf109da8b6d9a' - rootfs_path_xz =3D self.fetch_asset(rootfs_url, asset_hash=3Drootf= s_hash) - rootfs_path =3D 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 =3D (self.KERNEL_COMMON_COMMAND_LINE + - 'console=3DttyS0,115200 ' - 'root=3Db300 rootwait rw ' - 'panic=3D-1 noreboot') - self.vm.add_args('-kernel', kernel_path, - '-dtb', dtb_path, - '-drive', 'file=3D' + rootfs_path + ',if=3Dsd,for= mat=3Draw', - '-net', 'nic,model=3Dgmac,netdev=3Dhost_gmac', - '-netdev', 'user,id=3Dhost_gmac', - '-append', kernel_command_line, - '-no-reboot') - self.vm.launch() - shell_ready =3D "/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=3Darch:arm - :avocado: tags=3Dmachine:bpim2u - :avocado: tags=3Ddevice:sd - """ - - # This test download a 8.9 MiB compressed image and expand it - # to 127 MiB. - image_url =3D ('https://downloads.openwrt.org/releases/22.03.3/tar= gets/' - 'sunxi/cortexa7/openwrt-22.03.3-sunxi-cortexa7-' - 'sinovoip_bananapi-m2-ultra-ext4-sdcard.img.gz') - image_hash =3D ('5b41b4e11423e562c6011640f9a7cd3b' - 'dd0a3d42b83430f7caa70a432e6cd82c') - image_path_gz =3D self.fetch_asset(image_url, asset_hash=3Dimage_h= ash, - algorithm=3D'sha256') - image_path =3D archive.extract(image_path_gz, self.workdir) - image_pow2ceil_expand(image_path) - - self.vm.set_console() - self.vm.add_args('-drive', 'file=3D' + image_path + ',if=3Dsd,form= at=3Draw', - '-nic', 'user', - '-no-reboot') - self.vm.launch() - - kernel_command_line =3D (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:', '=3D>') - exec_command_and_wait_for_pattern(self, "setenv extraargs '" + - kernel_command_line + "'",= '=3D>') - 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=3Darch:arm diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 2ae4e415ce..e7cac3aeee 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -16,6 +16,7 @@ test_timeouts =3D { 'aarch64_virt' : 360, 'acpi_bits' : 240, 'arm_aspeed' : 600, + 'arm_bpim2u' : 360, 'arm_raspi2' : 120, 'arm_tuxrun' : 120, 'mips_malta' : 120, @@ -54,6 +55,7 @@ tests_alpha_system_thorough =3D [ =20 tests_arm_system_thorough =3D [ 'arm_aspeed', + 'arm_bpim2u', 'arm_canona1100', 'arm_integratorcp', 'arm_raspi2', diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_te= st/utils.py index 2a1cb60d38..1bf1c410d5 100644 --- a/tests/functional/qemu_test/utils.py +++ b/tests/functional/qemu_test/utils.py @@ -15,6 +15,27 @@ import subprocess import tarfile =20 +""" +Round up to next power of 2 +""" +def pow2ceil(x): + return 1 if x =3D=3D 0 else 2**(x - 1).bit_length() + +def file_truncate(path, size): + if size !=3D 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 =3D os.path.getsize(path) + size_aligned =3D pow2ceil(size) + if size !=3D size_aligned: + with open(path, 'ab+') as fd: + fd.truncate(size_aligned) + def archive_extract(archive, dest_dir, member=3DNone): with tarfile.open(archive) as tf: if hasattr(tarfile, 'data_filter'): diff --git a/tests/functional/test_arm_bpim2u.py b/tests/functional/test_ar= m_bpim2u.py new file mode 100755 index 0000000000..2f9fa145e3 --- /dev/null +++ b/tests/functional/test_arm_bpim2u.py @@ -0,0 +1,206 @@ +#!/usr/bin/env python3 +# +# Functional test that boots a Linux kernel on a Banana Pi machine +# and checks the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os + +from qemu_test import LinuxKernelTest, exec_command_and_wait_for_pattern +from qemu_test import Asset, interrupt_interactive_console_until_pattern +from qemu_test.utils import archive_extract, gzip_uncompress, lzma_uncompr= ess +from qemu_test.utils import image_pow2ceil_expand +from unittest import skipUnless + +class BananaPiMachine(LinuxKernelTest): + + ASSET_DEB =3D Asset( + ('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'), + '3d968c15b121ede871dce49d13ee7644d6f74b6b121b84c9a40f51b0c80d6d22') + + ASSET_INITRD =3D Asset( + ('https://github.com/groeck/linux-build-test/raw/' + '2eb0a73b5d5a28df3170c546ddaaa9757e1e0848/rootfs/' + 'arm/rootfs-armv7a.cpio.gz'), + '2c8dbdb16ea7af2dfbcbea96044dde639fb07d09fd3c4fb31f2027ef71e55ddd') + + ASSET_ROOTFS =3D Asset( + ('http://storage.kernelci.org/images/rootfs/buildroot/' + 'buildroot-baseline/20230703.0/armel/rootfs.ext2.xz'), + '42b44a12965ac0afe9a88378527fb698a7dc76af50495efc2361ee1595b4e5c6') + + ASSET_SD_IMAGE =3D Asset( + ('https://downloads.openwrt.org/releases/22.03.3/targets/sunxi/cor= texa7/' + 'openwrt-22.03.3-sunxi-cortexa7-sinovoip_bananapi-m2-ultra-ext4-s= dcard.img.gz'), + '5b41b4e11423e562c6011640f9a7cd3bdd0a3d42b83430f7caa70a432e6cd82c') + + def test_arm_bpim2u(self): + """ + :avocado: tags=3Darch:arm + :avocado: tags=3Dmachine:bpim2u + :avocado: tags=3Daccel:tcg + """ + self.set_machine('bpim2u') + deb_path =3D self.ASSET_DEB.fetch() + kernel_path =3D self.extract_from_deb(deb_path, + '/boot/vmlinuz-6.6.16-current-= sunxi') + dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' + 'sun8i-r40-bananapi-m2-ultra.dtb') + dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3DttyS0,115200n8 ' + 'earlycon=3Duart,mmio32,0x1c28000') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + self.vm.launch() + console_pattern =3D 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) + os.remove(kernel_path) + os.remove(dtb_path) + + def test_arm_bpim2u_initrd(self): + """ + :avocado: tags=3Darch:arm + :avocado: tags=3Daccel:tcg + :avocado: tags=3Dmachine:bpim2u + """ + self.set_machine('bpim2u') + deb_path =3D self.ASSET_DEB.fetch() + kernel_path =3D self.extract_from_deb(deb_path, + '/boot/vmlinuz-6.6.16-current-= sunxi') + dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' + 'sun8i-r40-bananapi-m2-ultra.dtb') + dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + initrd_path_gz =3D self.ASSET_INITRD.fetch() + initrd_path =3D os.path.join(self.workdir, 'rootfs.cpio') + gzip_uncompress(initrd_path_gz, initrd_path) + + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3DttyS0,115200 ' + 'panic=3D-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() + os.remove(kernel_path) + os.remove(dtb_path) + os.remove(initrd_path) + + def test_arm_bpim2u_gmac(self): + """ + :avocado: tags=3Darch:arm + :avocado: tags=3Dmachine:bpim2u + :avocado: tags=3Ddevice:sd + """ + self.set_machine('bpim2u') + self.require_netdev('user') + + deb_path =3D self.ASSET_DEB.fetch() + kernel_path =3D self.extract_from_deb(deb_path, + '/boot/vmlinuz-6.6.16-current-= sunxi') + dtb_path =3D ('/usr/lib/linux-image-6.6.16-current-sunxi/' + 'sun8i-r40-bananapi-m2-ultra.dtb') + dtb_path =3D self.extract_from_deb(deb_path, dtb_path) + rootfs_path_xz =3D self.ASSET_ROOTFS.fetch() + rootfs_path =3D os.path.join(self.workdir, 'rootfs.cpio') + lzma_uncompress(rootfs_path_xz, rootfs_path) + image_pow2ceil_expand(rootfs_path) + + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3DttyS0,115200 ' + 'root=3Db300 rootwait rw ' + 'panic=3D-1 noreboot') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-drive', 'file=3D' + rootfs_path + ',if=3Dsd,for= mat=3Draw', + '-net', 'nic,model=3Dgmac,netdev=3Dhost_gmac', + '-netdev', 'user,id=3Dhost_gmac', + '-append', kernel_command_line, + '-no-reboot') + self.vm.launch() + shell_ready =3D "/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() + os.remove(kernel_path) + os.remove(dtb_path) + os.remove(rootfs_path) + + @skipUnless(os.getenv('QEMU_TEST_ALLOW_LARGE_STORAGE'), 'storage limit= ed') + def test_arm_bpim2u_openwrt_22_03_3(self): + """ + :avocado: tags=3Darch:arm + :avocado: tags=3Dmachine:bpim2u + :avocado: tags=3Ddevice:sd + """ + self.set_machine('bpim2u') + # This test download a 8.9 MiB compressed image and expand it + # to 127 MiB. + image_path_gz =3D self.ASSET_SD_IMAGE.fetch() + image_path =3D os.path.join(self.workdir, 'sdcard.img') + gzip_uncompress(image_path_gz, image_path) + image_pow2ceil_expand(image_path) + + self.vm.set_console() + self.vm.add_args('-drive', 'file=3D' + image_path + ',if=3Dsd,form= at=3Draw', + '-nic', 'user', + '-no-reboot') + self.vm.launch() + + kernel_command_line =3D (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:', '=3D>') + exec_command_and_wait_for_pattern(self, "setenv extraargs '" + + kernel_command_line + "'",= '=3D>') + 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') + os.remove(image_path) + +if __name__ =3D=3D '__main__': + LinuxKernelTest.main() --=20 2.47.0