From nobody Sun Nov 24 08:20:20 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=1725971990; cv=none; d=zohomail.com; s=zohoarc; b=cEv28pLHF5FL9FhppXmdJhrWnMtnROC6U0Im7JBiq1zh9ycPh3gCz+9yww4ZmJRTXlyc/T2BlG2vuBjwi5anSKMLS2+QOzX/1yMr2kWC0qo9uy4ArbE9vtPBLDKebhgvvF4yayS3TAAzMM0NNcZVfi0frQ27Rsc0R5aQHLymtmE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725971990; h=Content-Type: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=LVaaTJLyg1RTdI2f1wGKW2XRJiJ9kTbEGsOe2P0JmTg=; b=PSd/GMu8oILoyIgffLoh1U+nka+nqxBUg0DHvBLKeiQzeCMDbOPCYdxN2bmuR77c4iERQGGsj10DIuh6OwX8AmnNW95Vg5oGHHjVFueyvnLZpOnsRjPz5Pb2MWElZ0h/9bG5Qz97aiHxcmw/MqkT+cmY/iLEz9NV8Ef/4jVRpwA= 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 1725971990441664.0226704114275; Tue, 10 Sep 2024 05:39:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so08a-00050O-23; Tue, 10 Sep 2024 08:38:29 -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 1so08W-0004XP-0g for qemu-devel@nongnu.org; Tue, 10 Sep 2024 08:38:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so08N-0005Bv-Ne for qemu-devel@nongnu.org; Tue, 10 Sep 2024 08:38:23 -0400 Received: from mx-prod-mc-04.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-508-iZPSThNEPEe1-aIs8CG02w-1; Tue, 10 Sep 2024 08:38:10 -0400 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 56BBB1954233; Tue, 10 Sep 2024 12:38:09 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.193.120]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C474B19560AB; Tue, 10 Sep 2024 12:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725971891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LVaaTJLyg1RTdI2f1wGKW2XRJiJ9kTbEGsOe2P0JmTg=; b=XvzRfRGF5oOqVhLIhWkLpvHLb17nbeKRaJCZ5p8u7/Ob0h+uMrLUDyKgKASzknedEdjGZ/ ntFWEZjlPtoGlJxXnIxK1MJBlNzJTG+cBtQVIsw6EWjpTxNIc/X5QbfZu016dahacCZugU YQS+DrNakz9R9t1RmP1sH15NVw7XdB4= X-MC-Unique: iZPSThNEPEe1-aIs8CG02w-1 From: Thomas Huth To: qemu-devel@nongnu.org Cc: Peter Maydell Subject: [PULL 17/22] tests/functional: Convert Aarch64 Raspi4 avocado tests Date: Tue, 10 Sep 2024 14:37:18 +0200 Message-ID: <20240910123726.182975-18-thuth@redhat.com> In-Reply-To: <20240910123726.182975-1-thuth@redhat.com> References: <20240910123726.182975-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 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.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.145, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, T_SPF_TEMPERROR=0.01 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: 1725971991172116600 From: Philippe Mathieu-Daud=C3=A9 Straight forward conversion. Update the SHA1 hashes to SHA256 hashes since SHA1 should not be used anymore nowadays. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20240826221058.75126-5-philmd@linaro.org> [thuth: Use LinuxKernelTest class] Message-ID: <20240906180549.792832-12-thuth@redhat.com> Signed-off-by: Thomas Huth --- MAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 97 ------------------------ tests/functional/meson.build | 1 + tests/functional/test_aarch64_raspi4.py | 99 +++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 97 deletions(-) create mode 100755 tests/functional/test_aarch64_raspi4.py diff --git a/MAINTAINERS b/MAINTAINERS index 828c469478..c59f7b2538 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -913,6 +913,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 =20 Real View M: Peter Maydell diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux= _console.py index e4caf34379..a8eac44d9f 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -203,103 +203,6 @@ def test_arm_emcraft_sf2(self): exec_command_and_wait_for_pattern(self, 'ping -c 3 10.0.2.2', '3 packets transmitted, 3 packets received, 0% packet loss') =20 - def test_arm_raspi4(self): - """ - :avocado: tags=3Darch:aarch64 - :avocado: tags=3Dmachine:raspi4b - :avocado: tags=3Ddevice:pl011 - :avocado: tags=3Daccel:tcg - :avocado: tags=3Drpi4b - - The kernel can be rebuilt using the kernel source referenced - and following the instructions on the on: - https://www.raspberrypi.org/documentation/linux/kernel/building.md - """ - - deb_url =3D ('http://archive.raspberrypi.org/debian/' - 'pool/main/r/raspberrypi-firmware/' - 'raspberrypi-kernel_1.20230106-1_arm64.deb') - deb_hash =3D '08dc55696535b18a6d4fe6fa10d4c0d905cbb2ed' - deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) - kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel8.img= ') - dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-= b.dtb') - - self.vm.set_console() - kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + - 'earlycon=3Dpl011,mmio32,0xfe201000 ' + - 'console=3DttyAMA0,115200 ' + - 'root=3D/dev/mmcblk1p2 rootwait ' + - 'dwc_otg.fiq_fsm_enable=3D0') - self.vm.add_args('-kernel', kernel_path, - '-dtb', dtb_path, - '-append', kernel_command_line) - # When PCI is supported we can add a USB controller: - # '-device', 'qemu-xhci,bus=3Dpcie.1,id=3Dxhci', - # '-device', 'usb-kbd,bus=3Dxhci.0', - self.vm.launch() - console_pattern =3D 'Kernel command line: %s' % kernel_command_line - self.wait_for_console_pattern(console_pattern) - # When USB is enabled we can look for this - # console_pattern =3D 'Product: QEMU USB Keyboard' - # self.wait_for_console_pattern(console_pattern) - console_pattern =3D 'Waiting for root device' - self.wait_for_console_pattern(console_pattern) - - - def test_arm_raspi4_initrd(self): - """ - :avocado: tags=3Darch:aarch64 - :avocado: tags=3Dmachine:raspi4b - :avocado: tags=3Ddevice:pl011 - :avocado: tags=3Daccel:tcg - :avocado: tags=3Drpi4b - - The kernel can be rebuilt using the kernel source referenced - and following the instructions on the on: - https://www.raspberrypi.org/documentation/linux/kernel/building.md - """ - deb_url =3D ('http://archive.raspberrypi.org/debian/' - 'pool/main/r/raspberrypi-firmware/' - 'raspberrypi-kernel_1.20230106-1_arm64.deb') - deb_hash =3D '08dc55696535b18a6d4fe6fa10d4c0d905cbb2ed' - deb_path =3D self.fetch_asset(deb_url, asset_hash=3Ddeb_hash) - kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel8.img= ') - dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-= b.dtb') - - initrd_url =3D ('https://github.com/groeck/linux-build-test/raw/' - '86b2be1384d41c8c388e63078a847f1e1c4cb1de/rootfs/' - 'arm64/rootfs.cpio.gz') - initrd_hash =3D 'f3d4f9fa92a49aa542f1b44d34be77bbf8ca5b9d' - 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 + - 'earlycon=3Dpl011,mmio32,0xfe201000 ' + - 'console=3DttyAMA0,115200 ' + - 'panic=3D-1 noreboot ' + - 'dwc_otg.fiq_fsm_enable=3D0') - self.vm.add_args('-kernel', kernel_path, - '-dtb', dtb_path, - '-initrd', initrd_path, - '-append', kernel_command_line, - '-no-reboot') - # When PCI is supported we can add a USB controller: - # '-device', 'qemu-xhci,bus=3Dpcie.1,id=3Dxhci', - # '-device', 'usb-kbd,bus=3Dxhci.0', - self.vm.launch() - self.wait_for_console_pattern('Boot successful.') - - exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', - 'BCM2835') - exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', - 'cprman@7e101000') - exec_command_and_wait_for_pattern(self, 'halt', 'reboot: System ha= lted') - # TODO: Raspberry Pi4 doesn't shut down properly with recent kerne= ls - # Wait for VM to shut down gracefully - #self.vm.wait() - def test_arm_exynos4210_initrd(self): """ :avocado: tags=3Darch:arm diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 35eebbe9b9..a79083b0f9 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -36,6 +36,7 @@ tests_generic_bsduser =3D [ =20 tests_aarch64_system_thorough =3D [ 'aarch64_raspi3', + 'aarch64_raspi4', 'aarch64_sbsaref', 'aarch64_virt', ] diff --git a/tests/functional/test_aarch64_raspi4.py b/tests/functional/tes= t_aarch64_raspi4.py new file mode 100755 index 0000000000..e5c9f77479 --- /dev/null +++ b/tests/functional/test_aarch64_raspi4.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 +# +# Functional test that boots a Linux kernel on a Raspberry Pi machine +# and checks the console +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import os + +from qemu_test import LinuxKernelTest, Asset +from qemu_test import exec_command_and_wait_for_pattern +from qemu_test.utils import gzip_uncompress + + +class Aarch64Raspi4Machine(LinuxKernelTest): + + """ + The kernel can be rebuilt using the kernel source referenced + and following the instructions on the on: + https://www.raspberrypi.org/documentation/linux/kernel/building.md + """ + ASSET_KERNEL_20190215 =3D Asset( + ('http://archive.raspberrypi.org/debian/' + 'pool/main/r/raspberrypi-firmware/' + 'raspberrypi-kernel_1.20230106-1_arm64.deb'), + '56d5713c8f6eee8a0d3f0e73600ec11391144fef318b08943e9abd94c0a9baf7') + + ASSET_INITRD =3D Asset( + ('https://github.com/groeck/linux-build-test/raw/' + '86b2be1384d41c8c388e63078a847f1e1c4cb1de/rootfs/' + 'arm64/rootfs.cpio.gz'), + '7c0b16d1853772f6f4c3ca63e789b3b9ff4936efac9c8a01fb0c98c05c7a7648') + + def test_arm_raspi4(self): + deb_path =3D self.ASSET_KERNEL_20190215.fetch() + kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel8.img= ') + dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-= b.dtb') + + self.set_machine('raspi4b') + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=3Dpl011,mmio32,0xfe201000 ' + + 'console=3DttyAMA0,115200 ' + + 'root=3D/dev/mmcblk1p2 rootwait ' + + 'dwc_otg.fiq_fsm_enable=3D0') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-append', kernel_command_line) + # When PCI is supported we can add a USB controller: + # '-device', 'qemu-xhci,bus=3Dpcie.1,id=3Dxhci', + # '-device', 'usb-kbd,bus=3Dxhci.0', + self.vm.launch() + console_pattern =3D 'Kernel command line: %s' % kernel_command_line + self.wait_for_console_pattern(console_pattern) + # When USB is enabled we can look for this + # console_pattern =3D 'Product: QEMU USB Keyboard' + # self.wait_for_console_pattern(console_pattern) + console_pattern =3D 'Waiting for root device' + self.wait_for_console_pattern(console_pattern) + + + def test_arm_raspi4_initrd(self): + deb_path =3D self.ASSET_KERNEL_20190215.fetch() + kernel_path =3D self.extract_from_deb(deb_path, '/boot/kernel8.img= ') + dtb_path =3D self.extract_from_deb(deb_path, '/boot/bcm2711-rpi-4-= b.dtb') + 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.set_machine('raspi4b') + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'earlycon=3Dpl011,mmio32,0xfe201000 ' + + 'console=3DttyAMA0,115200 ' + + 'panic=3D-1 noreboot ' + + 'dwc_otg.fiq_fsm_enable=3D0') + self.vm.add_args('-kernel', kernel_path, + '-dtb', dtb_path, + '-initrd', initrd_path, + '-append', kernel_command_line, + '-no-reboot') + # When PCI is supported we can add a USB controller: + # '-device', 'qemu-xhci,bus=3Dpcie.1,id=3Dxhci', + # '-device', 'usb-kbd,bus=3Dxhci.0', + self.vm.launch() + self.wait_for_console_pattern('Boot successful.') + + exec_command_and_wait_for_pattern(self, 'cat /proc/cpuinfo', + 'BCM2835') + exec_command_and_wait_for_pattern(self, 'cat /proc/iomem', + 'cprman@7e101000') + exec_command_and_wait_for_pattern(self, 'halt', 'reboot: System ha= lted') + # TODO: Raspberry Pi4 doesn't shut down properly with recent kerne= ls + # Wait for VM to shut down gracefully + #self.vm.wait() + + +if __name__ =3D=3D '__main__': + LinuxKernelTest.main() --=20 2.46.0