Skip to contentSkip to conversation

Convert more boot_linux_console avocado tests

PATCH New Thomas Huth 1 participant 7 messages Dec 6, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover Convert more boot_linux_console avocado tests

These avocado tests can be converted to the functional framework without much tweaking, just switch them to the new Asset() handling and update the hashsums to sha256 instead.

Thomas Huth (6):
tests/functional: Convert the xlnx_versal_virt avocado test tests/functional: Convert the emcraft_sf2 avocado test tests/functional: Convert the smdkc210 avocado test tests/functional: Convert the cubieboard avocado tests tests/functional: Convert the quanta-gsj avocado test tests/functional: Convert the arm virt avocado test

 MAINTAINERS                                  |   5 +
 tests/avocado/boot_linux_console.py          | 376 -------------------
 tests/functional/meson.build                 |   8 +
 tests/functional/test_aarch64_xlnx_versal.py |  37 ++
 tests/functional/test_arm_cubieboard.py      | 150 ++++++++
 tests/functional/test_arm_emcraft_sf2.py     |  52 +++
 tests/functional/test_arm_quanta_gsj.py      |  99 +++++
 tests/functional/test_arm_smdkc210.py        |  57 +++
 tests/functional/test_arm_virt.py            |  30 ++
 9 files changed, 438 insertions(+), 376 deletions(-)
 create mode 100755 tests/functional/test_aarch64_xlnx_versal.py
 create mode 100755 tests/functional/test_arm_cubieboard.py
 create mode 100755 tests/functional/test_arm_emcraft_sf2.py
 create mode 100755 tests/functional/test_arm_quanta_gsj.py
 create mode 100755 tests/functional/test_arm_smdkc210.py
 create mode 100755 tests/functional/test_arm_virt.py
Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/6 tests/functional: Convert the xlnx_versal_virt avocado test

A straight-forward conversion of the xlnx_versal_virt boot test to the functional framework.

---
 MAINTAINERS                                  |  1 +
 tests/avocado/boot_linux_console.py          | 27 --------------
 tests/functional/meson.build                 |  1 +
 tests/functional/test_aarch64_xlnx_versal.py | 37 ++++++++++++++++++++
 4 files changed, 39 insertions(+), 27 deletions(-)
 create mode 100755 tests/functional/test_aarch64_xlnx_versal.py
MAINTAINERS +1 -0
index 727f18fae5..86cac83221 100644
@@ -1025,6 +1025,7 @@ F: hw/display/dpcd.c
 F: include/hw/display/dpcd.h
 F: docs/system/arm/xlnx-versal-virt.rst
 F: docs/system/arm/xlnx-zcu102.rst
+F: tests/functional/test_aarch64_xlnx_versal.py
 
 Xilinx Versal OSPI
 M: Francisco Iglesias <[email protected]>
tests/avocado/boot_linux_console.py +0 -27
index 12e24bb05a..44ee50c469 100644
@@ -116,33 +116,6 @@ def test_x86_64_pc(self):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
-    def test_aarch64_xlnx_versal_virt(self):
-        """
-        :avocado: tags=arch:aarch64
-        :avocado: tags=machine:xlnx-versal-virt
-        :avocado: tags=device:pl011
-        :avocado: tags=device:arm_gicv3
-        :avocado: tags=accel:tcg
-        """
-        images_url = ('http://ports.ubuntu.com/ubuntu-ports/dists/'
-                      'bionic-updates/main/installer-arm64/'
-                      '20101020ubuntu543.19/images/')
-        kernel_url = images_url + 'netboot/ubuntu-installer/arm64/linux'
-        kernel_hash = 'e167757620640eb26de0972f578741924abb3a82'
-        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-
-        initrd_url = images_url + 'netboot/ubuntu-installer/arm64/initrd.gz'
-        initrd_hash = 'cab5cb3fcefca8408aa5aae57f24574bfce8bdb9'
-        initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
-
-        self.vm.set_console()
-        self.vm.add_args('-m', '2G',
-                         '-accel', 'tcg',
-                         '-kernel', kernel_path,
-                         '-initrd', initrd_path)
-        self.vm.launch()
-        self.wait_for_console_pattern('Checked W+X mappings: passed')
-
     def test_arm_virt(self):
         """
         :avocado: tags=arch:arm
tests/functional/meson.build +1 -0
index 0558d0aa4e..698fb4976d 100644
@@ -58,6 +58,7 @@ tests_aarch64_system_thorough = [
   'aarch64_sbsaref_freebsd',
   'aarch64_tuxrun',
   'aarch64_virt',
+  'aarch64_xlnx_versal',
   'multiprocess',
 ]
 
tests/functional/test_aarch64_xlnx_versal.py new file +37 -0
new file mode 100755
index 0000000000..4b9c49e5d6
@@ -0,0 +1,37 @@
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel and checks the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import LinuxKernelTest, Asset
+
+class XlnxVersalVirtMachine(LinuxKernelTest):
+
+    ASSET_KERNEL = Asset(
+        ('http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/main/'
+         'installer-arm64/20101020ubuntu543.19/images/netboot/'
+         'ubuntu-installer/arm64/linux'),
+        'ce54f74ab0b15cfd13d1a293f2d27ffd79d8a85b7bb9bf21093ae9513864ac79')
+
+    ASSET_INITRD = Asset(
+        ('http://ports.ubuntu.com/ubuntu-ports/dists/bionic-updates/main/'
+         'installer-arm64/20101020ubuntu543.19/images/netboot/'
+         '/ubuntu-installer/arm64/initrd.gz'),
+        'e7a5e716b6f516d8be315c06e7331aaf16994fe4222e0e7cfb34bc015698929e')
+
+    def test_aarch64_xlnx_versal_virt(self):
+        self.set_machine('xlnx-versal-virt')
+        kernel_path = self.ASSET_KERNEL.fetch()
+        initrd_path = self.ASSET_INITRD.fetch()
+
+        self.vm.set_console()
+        self.vm.add_args('-m', '2G',
+                         '-accel', 'tcg',
+                         '-kernel', kernel_path,
+                         '-initrd', initrd_path)
+        self.vm.launch()
+        self.wait_for_console_pattern('Checked W+X mappings: passed')
+
+if __name__ == '__main__':
+    LinuxKernelTest.main()
Signature · 1 line
2.47.1
#2 lore raw

PATCH 2/6 tests/functional: Convert the emcraft_sf2 avocado test

In reply to Thomas Huth

A pretty straight-forward conversion of the emcraft_sf2 boot test to the functional framework.

This was the last test that used file_truncate() in boot_linux_console.py, so we can remove that function from that file now, too.

---
 MAINTAINERS                              |  1 +
 tests/avocado/boot_linux_console.py      | 44 --------------------
 tests/functional/meson.build             |  1 +
 tests/functional/test_arm_emcraft_sf2.py | 52 ++++++++++++++++++++++++
 4 files changed, 54 insertions(+), 44 deletions(-)
 create mode 100755 tests/functional/test_arm_emcraft_sf2.py
MAINTAINERS +1 -0
index 86cac83221..435a87b146 100644
@@ -1116,6 +1116,7 @@ L: [email protected]
 S: Maintained
 F: hw/arm/msf2-som.c
 F: docs/system/arm/emcraft-sf2.rst
+F: tests/functional/test_arm_emcraft_sf2.py
 
 ASPEED BMCs
 M: Cédric Le Goater <[email protected]>
tests/avocado/boot_linux_console.py +0 -44

56 lines not on this page · raw message

tests/functional/meson.build +1 -0
index 698fb4976d..22b50b7fb3 100644
@@ -75,6 +75,7 @@ tests_arm_system_thorough = [
   'arm_bpim2u',
   'arm_canona1100',
   'arm_collie',
+  'arm_emcraft_sf2',
   'arm_integratorcp',
   'arm_orangepi',
   'arm_raspi2',
tests/functional/test_arm_emcraft_sf2.py new file +52 -0

52 lines not on this page · raw message

Signature · 1 line
2.47.1
#3 lore raw

PATCH 3/6 tests/functional: Convert the smdkc210 avocado test

In reply to Thomas Huth

A straight forward conversion, just the hashsums needed to be updated to sha256 now.

---
 MAINTAINERS                           |  1 +
 tests/avocado/boot_linux_console.py   | 41 -------------------
 tests/functional/meson.build          |  1 +
 tests/functional/test_arm_smdkc210.py | 57 +++++++++++++++++++++++++++
 4 files changed, 59 insertions(+), 41 deletions(-)
 create mode 100755 tests/functional/test_arm_smdkc210.py
MAINTAINERS +1 -0
index 435a87b146..9b1c3459b4 100644
@@ -720,6 +720,7 @@ S: Odd Fixes
 F: hw/*/exynos*
 F: include/hw/*/exynos*
 F: docs/system/arm/exynos.rst
+F: tests/functional/test_arm_smdkc210.py
 
 Calxeda Highbank
 M: Rob Herring <[email protected]>
tests/avocado/boot_linux_console.py +0 -41

47 lines not on this page · raw message

tests/functional/meson.build +1 -0
index 22b50b7fb3..905afba4a6 100644
@@ -79,6 +79,7 @@ tests_arm_system_thorough = [
   'arm_integratorcp',
   'arm_orangepi',
   'arm_raspi2',
+  'arm_smdkc210',
   'arm_sx1',
   'arm_vexpress',
   'arm_tuxrun',
tests/functional/test_arm_smdkc210.py new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.47.1
#4 lore raw

PATCH 4/6 tests/functional: Convert the cubieboard avocado tests

In reply to Thomas Huth

Straight forward conversion, just the hashsums needed to be updated to sha256 now.

These were the last tests that used image_pow2ceil_expand in boot_linux_console.py, so we can remove that function from that file now, too.

---
 MAINTAINERS                             |   1 +
 tests/avocado/boot_linux_console.py     | 157 ------------------------
 tests/functional/meson.build            |   2 +
 tests/functional/test_arm_cubieboard.py | 150 ++++++++++++++++++++++
 4 files changed, 153 insertions(+), 157 deletions(-)
 create mode 100755 tests/functional/test_arm_cubieboard.py
MAINTAINERS +1 -0
index 9b1c3459b4..dc583d5853 100644
@@ -633,6 +633,7 @@ F: include/hw/*/allwinner*
 F: hw/arm/cubieboard.c
 F: docs/system/arm/cubieboard.rst
 F: hw/misc/axp209.c
+F: tests/functional/test_arm_cubieboard.py
 
 Allwinner-h3
 M: Niek Linnenbank <[email protected]>
tests/avocado/boot_linux_console.py +0 -157

169 lines not on this page · raw message

tests/functional/meson.build +2 -0
index 905afba4a6..8457b14b37 100644
@@ -21,6 +21,7 @@ test_timeouts = {
   'arm_aspeed' : 600,
   'arm_bpim2u' : 500,
   'arm_collie' : 180,
+  'arm_cubieboard' : 360,
   'arm_orangepi' : 540,
   'arm_raspi2' : 120,
   'arm_tuxrun' : 240,
@@ -75,6 +76,7 @@ tests_arm_system_thorough = [
   'arm_bpim2u',
   'arm_canona1100',
   'arm_collie',
+  'arm_cubieboard',
   'arm_emcraft_sf2',
   'arm_integratorcp',
   'arm_orangepi',
tests/functional/test_arm_cubieboard.py new file +150 -0

150 lines not on this page · raw message

Signature · 1 line
2.47.1
#5 lore raw

PATCH 5/6 tests/functional: Convert the quanta-gsj avocado test

In reply to Thomas Huth

Straight forward conversion, basically just the hashsums needed to be updated to sha256 now.

---
 MAINTAINERS                             |  1 +
 tests/avocado/boot_linux_console.py     | 86 ---------------------
 tests/functional/meson.build            |  2 +
 tests/functional/test_arm_quanta_gsj.py | 99 +++++++++++++++++++++++++
 4 files changed, 102 insertions(+), 86 deletions(-)
 create mode 100755 tests/functional/test_arm_quanta_gsj.py
MAINTAINERS +1 -0
index dc583d5853..a62659b330 100644
@@ -872,6 +872,7 @@ F: tests/qtest/adm1266-test.c
 F: pc-bios/npcm7xx_bootrom.bin
 F: roms/vbootrom
 F: docs/system/arm/nuvoton.rst
+F: tests/functional/test_arm_quanta_gsj.py
 
 Raspberry Pi
 M: Peter Maydell <[email protected]>
tests/avocado/boot_linux_console.py +0 -86

92 lines not on this page · raw message

tests/functional/meson.build +2 -0
index 8457b14b37..c7abda61d2 100644
@@ -23,6 +23,7 @@ test_timeouts = {
   'arm_collie' : 180,
   'arm_cubieboard' : 360,
   'arm_orangepi' : 540,
+  'arm_quanta_gsj' : 240,
   'arm_raspi2' : 120,
   'arm_tuxrun' : 240,
   'arm_sx1' : 360,
@@ -80,6 +81,7 @@ tests_arm_system_thorough = [
   'arm_emcraft_sf2',
   'arm_integratorcp',
   'arm_orangepi',
+  'arm_quanta_gsj',
   'arm_raspi2',
   'arm_smdkc210',
   'arm_sx1',
tests/functional/test_arm_quanta_gsj.py new file +99 -0

99 lines not on this page · raw message

Signature · 1 line
2.47.1
#6 lore raw

PATCH 6/6 tests/functional: Convert the arm virt avocado test

In reply to Thomas Huth

Straight forward conversion, basically just the hashsums needed to be updated to sha256 now.

---
 tests/avocado/boot_linux_console.py | 21 --------------------
 tests/functional/meson.build        |  1 +
 tests/functional/test_arm_virt.py   | 30 +++++++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 21 deletions(-)
 create mode 100755 tests/functional/test_arm_virt.py
tests/avocado/boot_linux_console.py +0 -21
index 5bc1c68af9..3bedff0d1f 100644
@@ -95,27 +95,6 @@ def test_x86_64_pc(self):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
-    def test_arm_virt(self):
-        """
-        :avocado: tags=arch:arm
-        :avocado: tags=machine:virt
-        :avocado: tags=accel:tcg
-        """
-        kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
-                      '/linux/releases/29/Everything/armhfp/os/images/pxeboot'
-                      '/vmlinuz')
-        kernel_hash = 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4'
-        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
-
-        self.vm.set_console()
-        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
-                               'console=ttyAMA0')
-        self.vm.add_args('-kernel', kernel_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_ast2600_debian(self):
         """
         :avocado: tags=arch:arm
tests/functional/meson.build +1 -0
index c7abda61d2..30c3eda7e4 100644
@@ -86,6 +86,7 @@ tests_arm_system_thorough = [
   'arm_smdkc210',
   'arm_sx1',
   'arm_vexpress',
+  'arm_virt',
   'arm_tuxrun',
 ]
 
tests/functional/test_arm_virt.py new file +30 -0
new file mode 100755
index 0000000000..7b6549176f
@@ -0,0 +1,30 @@
+#!/usr/bin/env python3
+#
+# Functional test that boots a Linux kernel and checks the console
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import LinuxKernelTest, Asset
+
+class ArmVirtMachine(LinuxKernelTest):
+
+    ASSET_KERNEL = Asset(
+        ('https://archives.fedoraproject.org/pub/archive/fedora/linux/'
+         'releases/29/Everything/armhfp/os/images/pxeboot/vmlinuz'),
+        '18dd5f1a9a28bd539f9d047f7c0677211bae528e8712b40ca5a229a4ad8e2591')
+
+    def test_arm_virt(self):
+        self.set_machine('virt')
+        kernel_path = self.ASSET_KERNEL.fetch()
+
+        self.vm.set_console()
+        kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
+                               'console=ttyAMA0')
+        self.vm.add_args('-kernel', kernel_path,
+                         '-append', kernel_command_line)
+        self.vm.launch()
+        console_pattern = 'Kernel command line: %s' % kernel_command_line
+        self.wait_for_console_pattern(console_pattern)
+
+if __name__ == '__main__':
+    LinuxKernelTest.main()
Signature · 1 line
2.47.1