diff mbox series

[3/4] tests/functional: Convert Aarch64 Raspi3 avocado tests

Message ID 20240826221058.75126-4-philmd@linaro.org
State New
Headers show
Series tests/functional: Convert Raspberry Pi avocado tests | expand

Commit Message

Philippe Mathieu-Daudé Aug. 26, 2024, 10:10 p.m. UTC
Straight forward conversion. Update the SHA1 hashes to SHA256
hashes since SHA1 should not be used anymore nowadays.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 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
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index e2bbf1a994..9ce41df6d8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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 <peter.maydell@linaro.org>
diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux_console.py
index 226b92d057..cb7301a456 100644
--- a/tests/avocado/boot_linux_console.py
+++ b/tests/avocado/boot_linux_console.py
@@ -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
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
index ec77835199..3fab8e0d0c 100644
--- a/tests/functional/meson.build
+++ b/tests/functional/meson.build
@@ -26,6 +26,10 @@  tests_generic = [
   'version',
 ]
 
+tests_aarch64_thorough = [
+  'aarch64_raspi3',
+]
+
 tests_arm_thorough = [
   'arm_canona1100',
   'arm_n8x0',
diff --git a/tests/functional/test_aarch64_raspi3.py b/tests/functional/test_aarch64_raspi3.py
new file mode 100755
index 0000000000..630b1039ee
--- /dev/null
+++ b/tests/functional/test_aarch64_raspi3.py
@@ -0,0 +1,42 @@ 
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel on a Raspberry Pi machine
+# and checks the console
+#
+# Copyright (c) 2020 Philippe Mathieu-Daudé <f4bug@amsat.org>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+import os
+from zipfile import ZipFile
+
+from qemu_test import QemuSystemTest, Asset
+from qemu_test.linux_kernel import linux_kernel_wait_for_pattern
+
+
+class Aarch64Raspi3Machine(QemuSystemTest):
+
+    ASSET_RPI3_UEFI = Asset(
+        ('https://github.com/pbatard/RPi3/releases/download/'
+         'v1.15/RPi3_UEFI_Firmware_v1.15.zip'),
+        '8cff2e979560048b4c84921f41a91893240b9fb71a88f0b5c5d6c8edd994bd5b')
+
+    def test_aarch64_raspi3_atf(self):
+        efi_name = 'RPI_EFI.fd'
+        zip_path = self.ASSET_RPI3_UEFI.fetch()
+
+        with ZipFile(zip_path, 'r') as zf:
+                     zf.extract(efi_name, path=self.workdir)
+        efi_fd = os.path.join(self.workdir, efi_name)
+
+        self.set_machine('raspi3b')
+        self.vm.set_console(console_index=1)
+        self.vm.add_args('-cpu', 'cortex-a53',
+                         '-nodefaults',
+                         '-device', f'loader,file={efi_fd},force-raw=true')
+        self.vm.launch()
+        linux_kernel_wait_for_pattern(self, 'version UEFI Firmware v1.15')
+
+
+if __name__ == '__main__':
+    QemuSystemTest.main()