Skip to contentSkip to conversation

tests/functional: Add test for imx8mp-evk board with USDHC coverage

PATCH In review Bernhard Beschow 4 participants 7 messages Apr 9, 2025 – May 2, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests/functional: Add test for imx8mp-evk board with USDHC coverage

Introduce a functional test which boots Debian 12 on the imx8mp-evk board. Since the root filesystem resides on an SD card, the test also verifies the basic operation of the USDHC.

--
v2:
* Make test file executable (Thomas)
* Omit fetch() (Thomas)
* Omit "-accel tcg" (Thomas)
* Add "snapshot=on" to make potential future tests independent

Supersedes: [email protected]

---
 MAINTAINERS                                 |  1 +
 tests/functional/meson.build                |  1 +
 tests/functional/test_aarch64_imx8mp_evk.py | 66 +++++++++++++++++++++
 3 files changed, 68 insertions(+)
 create mode 100755 tests/functional/test_aarch64_imx8mp_evk.py
MAINTAINERS +1 -0
index d54b5578f8..4ceffa89dc 100644
@@ -833,6 +833,7 @@ F: include/hw/arm/fsl-imx8mp.h
 F: include/hw/misc/imx8mp_*.h
 F: include/hw/pci-host/fsl_imx8m_phy.h
 F: docs/system/arm/imx8mp-evk.rst
+F: tests/functional/test_aarch64_imx8mp_evk.py
 F: tests/qtest/rs5c372-test.c
 
 MPS2 / MPS3
tests/functional/meson.build +1 -0
index 0f8be30fe2..aaaf3472f1 100644
@@ -75,6 +75,7 @@ tests_aarch64_system_quick = [
 
 tests_aarch64_system_thorough = [
   'aarch64_aspeed',
+  'aarch64_imx8mp_evk',
   'aarch64_raspi3',
   'aarch64_raspi4',
   'aarch64_replay',
tests/functional/test_aarch64_imx8mp_evk.py new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
2.49.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 51 lines · Bernhard Beschow

Introduce a functional test which boots Debian 12 on the imx8mp-evk board. Since the root filesystem resides on an SD card, the test also verifies the basic operation of the USDHC.

--
v2:
* Make test file executable (Thomas)
* Omit fetch() (Thomas)
* Omit "-accel tcg" (Thomas)
* Add "snapshot=on" to make potential future tests independent

Supersedes: [email protected]

---
  MAINTAINERS                                 |  1 +
  tests/functional/meson.build                |  1 +
  tests/functional/test_aarch64_imx8mp_evk.py | 66 +++++++++++++++++++++
  3 files changed, 68 insertions(+)

create mode 100755 tests/functional/test_aarch64_imx8mp_evk.py

MAINTAINERS +1 -0
index d54b5578f8..4ceffa89dc 100644
@@ -833,6 +833,7 @@ F: include/hw/arm/fsl-imx8mp.h
  F: include/hw/misc/imx8mp_*.h
  F: include/hw/pci-host/fsl_imx8m_phy.h
  F: docs/system/arm/imx8mp-evk.rst
+F: tests/functional/test_aarch64_imx8mp_evk.py
  F: tests/qtest/rs5c372-test.c
 
  MPS2 / MPS3
tests/functional/meson.build +1 -0
index 0f8be30fe2..aaaf3472f1 100644
@@ -75,6 +75,7 @@ tests_aarch64_system_quick = [
 
  tests_aarch64_system_thorough = [
    'aarch64_aspeed',
+  'aarch64_imx8mp_evk',
    'aarch64_raspi3',
    'aarch64_raspi4',
    'aarch64_replay',
tests/functional/test_aarch64_imx8mp_evk.py new file +0 -0
new file mode 100755
index 0000000000..62fee74044

tests/functional/test_aarch64_imx8mp_evk.py line 8

Quoted 8 lines
tests/functional/test_aarch64_imx8mp_evk.py new file +8 -0
@@ -0,0 +1,66 @@
+#!/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
+

In case you respin (due to other reasons), please add a second empty line before the "class" statement (that's the style that we use in the other tests, too).

Anyway:

Quoted 58 lines
tests/functional/test_aarch64_imx8mp_evk.py new file +58 -0
+class Imx8mpEvkMachine(LinuxKernelTest):
+
+    ASSET_IMAGE = Asset(
+        ('https://cloud.debian.org/images/cloud/bookworm/20231210-1590/'
+         'debian-12-generic-arm64-20231210-1590.tar.xz'),
+        '7ebf1577b32d5af6204df74b54ca2e4675de9b5a9fa14f3ff70b88eeb7b3b359')
+
+    KERNEL_OFFSET = 0x51000000
+    KERNEL_SIZE = 32622528
+    INITRD_OFFSET = 0x76000000
+    INITRD_SIZE = 30987766
+    DTB_OFFSET = 0x64F51000
+    DTB_SIZE = 45 * 1024
+
+    def extract(self, in_path, out_path, offset, size):
+        try:
+            with open(in_path, "rb") as source:
+                source.seek(offset)
+                data = source.read(size)
+            with open(out_path, "wb") as target:
+                target.write(data)
+        except (IOError, ValueError) as e:
+            self.log.error(f"Failed to extract {out_path}: {e}")
+            raise
+
+    def setUp(self):
+        super().setUp()
+
+        self.image_path = self.scratch_file("disk.raw")
+        self.kernel_path = self.scratch_file("linux")
+        self.initrd_path = self.scratch_file("initrd.zstd")
+        self.dtb_path = self.scratch_file("imx8mp-evk.dtb")
+
+        self.archive_extract(self.ASSET_IMAGE)
+        self.extract(self.image_path, self.kernel_path,
+                     self.KERNEL_OFFSET, self.KERNEL_SIZE)
+        self.extract(self.image_path, self.initrd_path,
+                     self.INITRD_OFFSET, self.INITRD_SIZE)
+        self.extract(self.image_path, self.dtb_path,
+                     self.DTB_OFFSET, self.DTB_SIZE)
+
+    def test_aarch64_imx8mp_evk_usdhc(self):
+        self.set_machine('imx8mp-evk')
+        self.vm.set_console(console_index=1)
+        self.vm.add_args('-m', '2G',
+                         '-smp', '4',
+                         '-kernel', self.kernel_path,
+                         '-initrd', self.initrd_path,
+                         '-dtb', self.dtb_path,
+                         '-append', 'root=/dev/mmcblk2p1',
+                         '-drive', f'file={self.image_path},if=sd,bus=2,'
+                                    'format=raw,id=mmcblk2,snapshot=on')
+
+        self.vm.launch()
+        self.wait_for_console_pattern('Welcome to ')
+
+if __name__ == '__main__':
+    LinuxKernelTest.main()
#2 lore raw

Am 10. April 2025 06:05:35 UTC schrieb Thomas Huth <[email protected]>:

Quoted 61 lines · Bernhard Beschow
Quoted 49 lines

Introduce a functional test which boots Debian 12 on the imx8mp-evk board. Since the root filesystem resides on an SD card, the test also verifies the basic operation of the USDHC.

--
v2:
* Make test file executable (Thomas)
* Omit fetch() (Thomas)
* Omit "-accel tcg" (Thomas)
* Add "snapshot=on" to make potential future tests independent

Supersedes: [email protected]

---
  MAINTAINERS                                 |  1 +
  tests/functional/meson.build                |  1 +
  tests/functional/test_aarch64_imx8mp_evk.py | 66 +++++++++++++++++++++
  3 files changed, 68 insertions(+)

create mode 100755 tests/functional/test_aarch64_imx8mp_evk.py

MAINTAINERS +1 -0
index d54b5578f8..4ceffa89dc 100644
@@ -833,6 +833,7 @@ F: include/hw/arm/fsl-imx8mp.h
  F: include/hw/misc/imx8mp_*.h
  F: include/hw/pci-host/fsl_imx8m_phy.h
  F: docs/system/arm/imx8mp-evk.rst
+F: tests/functional/test_aarch64_imx8mp_evk.py
  F: tests/qtest/rs5c372-test.c
    MPS2 / MPS3
tests/functional/meson.build +1 -0
index 0f8be30fe2..aaaf3472f1 100644
@@ -75,6 +75,7 @@ tests_aarch64_system_quick = [
    tests_aarch64_system_thorough = [
    'aarch64_aspeed',
+  'aarch64_imx8mp_evk',
    'aarch64_raspi3',
    'aarch64_raspi4',
    'aarch64_replay',
tests/functional/test_aarch64_imx8mp_evk.py new file +0 -0
new file mode 100755
index 0000000000..62fee74044

tests/functional/test_aarch64_imx8mp_evk.py line 8

Quoted 8 lines
tests/functional/test_aarch64_imx8mp_evk.py new file +8 -0
@@ -0,0 +1,66 @@
+#!/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
+

In case you respin (due to other reasons), please add a second empty line before the "class" statement (that's the style that we use in the other tests, too).

Quoted 2 lines

Anyway:

Ping (not for 10.0)

Quoted 61 lines
Quoted 60 lines
tests/functional/test_aarch64_imx8mp_evk.py new file +58 -0
+class Imx8mpEvkMachine(LinuxKernelTest):
+
+    ASSET_IMAGE = Asset(
+        ('https://cloud.debian.org/images/cloud/bookworm/20231210-1590/'
+         'debian-12-generic-arm64-20231210-1590.tar.xz'),
+        '7ebf1577b32d5af6204df74b54ca2e4675de9b5a9fa14f3ff70b88eeb7b3b359')
+
+    KERNEL_OFFSET = 0x51000000
+    KERNEL_SIZE = 32622528
+    INITRD_OFFSET = 0x76000000
+    INITRD_SIZE = 30987766
+    DTB_OFFSET = 0x64F51000
+    DTB_SIZE = 45 * 1024
+
+    def extract(self, in_path, out_path, offset, size):
+        try:
+            with open(in_path, "rb") as source:
+                source.seek(offset)
+                data = source.read(size)
+            with open(out_path, "wb") as target:
+                target.write(data)
+        except (IOError, ValueError) as e:
+            self.log.error(f"Failed to extract {out_path}: {e}")
+            raise
+
+    def setUp(self):
+        super().setUp()
+
+        self.image_path = self.scratch_file("disk.raw")
+        self.kernel_path = self.scratch_file("linux")
+        self.initrd_path = self.scratch_file("initrd.zstd")
+        self.dtb_path = self.scratch_file("imx8mp-evk.dtb")
+
+        self.archive_extract(self.ASSET_IMAGE)
+        self.extract(self.image_path, self.kernel_path,
+                     self.KERNEL_OFFSET, self.KERNEL_SIZE)
+        self.extract(self.image_path, self.initrd_path,
+                     self.INITRD_OFFSET, self.INITRD_SIZE)
+        self.extract(self.image_path, self.dtb_path,
+                     self.DTB_OFFSET, self.DTB_SIZE)
+
+    def test_aarch64_imx8mp_evk_usdhc(self):
+        self.set_machine('imx8mp-evk')
+        self.vm.set_console(console_index=1)
+        self.vm.add_args('-m', '2G',
+                         '-smp', '4',
+                         '-kernel', self.kernel_path,
+                         '-initrd', self.initrd_path,
+                         '-dtb', self.dtb_path,
+                         '-append', 'root=/dev/mmcblk2p1',
+                         '-drive', f'file={self.image_path},if=sd,bus=2,'
+                                    'format=raw,id=mmcblk2,snapshot=on')
+
+        self.vm.launch()
+        self.wait_for_console_pattern('Welcome to ')
+
+if __name__ == '__main__':
+    LinuxKernelTest.main()
#3 lore raw
Quoted 64 lines · Bernhard Beschow

Am 10. April 2025 06:05:35 UTC schrieb Thomas Huth <[email protected]>:

Quoted 61 lines · Bernhard Beschow
Quoted 49 lines

Introduce a functional test which boots Debian 12 on the imx8mp-evk board. Since the root filesystem resides on an SD card, the test also verifies the basic operation of the USDHC.

--
v2:
* Make test file executable (Thomas)
* Omit fetch() (Thomas)
* Omit "-accel tcg" (Thomas)
* Add "snapshot=on" to make potential future tests independent

Supersedes: [email protected]

---
   MAINTAINERS                                 |  1 +
   tests/functional/meson.build                |  1 +
   tests/functional/test_aarch64_imx8mp_evk.py | 66 +++++++++++++++++++++
   3 files changed, 68 insertions(+)

create mode 100755 tests/functional/test_aarch64_imx8mp_evk.py

MAINTAINERS +1 -0
index d54b5578f8..4ceffa89dc 100644
@@ -833,6 +833,7 @@ F: include/hw/arm/fsl-imx8mp.h
   F: include/hw/misc/imx8mp_*.h
   F: include/hw/pci-host/fsl_imx8m_phy.h
   F: docs/system/arm/imx8mp-evk.rst
+F: tests/functional/test_aarch64_imx8mp_evk.py
   F: tests/qtest/rs5c372-test.c
     MPS2 / MPS3
tests/functional/meson.build +1 -0
index 0f8be30fe2..aaaf3472f1 100644
@@ -75,6 +75,7 @@ tests_aarch64_system_quick = [
     tests_aarch64_system_thorough = [
     'aarch64_aspeed',
+  'aarch64_imx8mp_evk',
     'aarch64_raspi3',
     'aarch64_raspi4',
     'aarch64_replay',
tests/functional/test_aarch64_imx8mp_evk.py new file +0 -0
new file mode 100755
index 0000000000..62fee74044

tests/functional/test_aarch64_imx8mp_evk.py line 8

Quoted 8 lines
tests/functional/test_aarch64_imx8mp_evk.py new file +8 -0
@@ -0,0 +1,66 @@
+#!/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
+

In case you respin (due to other reasons), please add a second empty line before the "class" statement (that's the style that we use in the other tests, too).

Quoted 4 lines
Quoted 2 lines

Anyway:

Ping (not for 10.0)

Peter, should this go through your arm tree, or shall I pick it up with other functional test patches for my next PR?

Thomas

#4 lore raw

Hi Thomas,

Quoted 66 lines · Thomas Huth
Quoted 65 lines · Bernhard Beschow

Am 10. April 2025 06:05:35 UTC schrieb Thomas Huth <[email protected]>:

Quoted 62 lines · Bernhard Beschow
Quoted 50 lines

Introduce a functional test which boots Debian 12 on the imx8mp-evk board. Since the root filesystem resides on an SD card, the test also verifies the basic operation of the USDHC.

Signature · 14 lines
v2:
* Make test file executable (Thomas)
* Omit fetch() (Thomas)
* Omit "-accel tcg" (Thomas)
* Add "snapshot=on" to make potential future tests independent

Supersedes: [email protected]
---
   MAINTAINERS                                 |  1 +
   tests/functional/meson.build                |  1 +
   tests/functional/test_aarch64_imx8mp_evk.py | 66 ++++++++++++++++ 
+++++
   3 files changed, 68 insertions(+)
   create mode 100755 tests/functional/test_aarch64_imx8mp_evk.py
MAINTAINERS +0 -0
index d54b5578f8..4ceffa89dc 100644
@@ -833,6 +833,7 @@ F: include/hw/arm/fsl-imx8mp.h

   F: include/hw/misc/imx8mp_*.h
   F: include/hw/pci-host/fsl_imx8m_phy.h
   F: docs/system/arm/imx8mp-evk.rst
+F: tests/functional/test_aarch64_imx8mp_evk.py
   F: tests/qtest/rs5c372-test.c
     MPS2 / MPS3

tests/functional/meson.build +0 -0
index 0f8be30fe2..aaaf3472f1 100644
@@ -75,6 +75,7 @@ tests_aarch64_system_quick = [

     tests_aarch64_system_thorough = [
     'aarch64_aspeed',
+  'aarch64_imx8mp_evk',
     'aarch64_raspi3',
     'aarch64_raspi4',
     'aarch64_replay',

tests/functional/test_aarch64_imx8mp_evk.py new file +0 -0
new file mode 100755
index 0000000000..62fee74044

tests/functional/test_aarch64_imx8mp_evk.py line 8

Quoted 8 lines
tests/functional/test_aarch64_imx8mp_evk.py new file +8 -0
@@ -0,0 +1,66 @@
+#!/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
+

In case you respin (due to other reasons), please add a second empty line before the "class" statement (that's the style that we use in the other tests, too).

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Anyway:

Ping (not for 10.0)

Peter, should this go through your arm tree, or shall I pick it up with other functional test patches for my next PR?

My preference would be like with previous Avocado tests: when a (functional) test concerns mostly a dedicated subsystem, I'd rather see the dedicated subsystem maintainers to take it, so they get familiar with the test. Except if the maintainers are busy or unresponsive of course.

#5 lore raw

Am 23. April 2025 11:31:31 UTC schrieb "Philippe Mathieu-Daudé" <[email protected]>:

Quoted 73 lines

Hi Thomas,

Quoted 70 lines · Thomas Huth
Quoted 68 lines · Bernhard Beschow

Am 10. April 2025 06:05:35 UTC schrieb Thomas Huth <[email protected]>:

Quoted 61 lines · Bernhard Beschow
Quoted 49 lines

Introduce a functional test which boots Debian 12 on the imx8mp-evk board. Since the root filesystem resides on an SD card, the test also verifies the basic operation of the USDHC.

Signature · 13 lines
v2:
* Make test file executable (Thomas)
* Omit fetch() (Thomas)
* Omit "-accel tcg" (Thomas)
* Add "snapshot=on" to make potential future tests independent

Supersedes: [email protected]
---
   MAINTAINERS                                 |  1 +
   tests/functional/meson.build                |  1 +
   tests/functional/test_aarch64_imx8mp_evk.py | 66 ++++++++++++++++ +++++
   3 files changed, 68 insertions(+)
   create mode 100755 tests/functional/test_aarch64_imx8mp_evk.py
MAINTAINERS +0 -0
index d54b5578f8..4ceffa89dc 100644
@@ -833,6 +833,7 @@ F: include/hw/arm/fsl-imx8mp.h

   F: include/hw/misc/imx8mp_*.h
   F: include/hw/pci-host/fsl_imx8m_phy.h
   F: docs/system/arm/imx8mp-evk.rst
+F: tests/functional/test_aarch64_imx8mp_evk.py
   F: tests/qtest/rs5c372-test.c
     MPS2 / MPS3

tests/functional/meson.build +0 -0
index 0f8be30fe2..aaaf3472f1 100644
@@ -75,6 +75,7 @@ tests_aarch64_system_quick = [

     tests_aarch64_system_thorough = [
     'aarch64_aspeed',
+  'aarch64_imx8mp_evk',
     'aarch64_raspi3',
     'aarch64_raspi4',
     'aarch64_replay',

tests/functional/test_aarch64_imx8mp_evk.py new file +0 -0
new file mode 100755
index 0000000000..62fee74044

tests/functional/test_aarch64_imx8mp_evk.py line 8

Quoted 8 lines
tests/functional/test_aarch64_imx8mp_evk.py new file +8 -0
@@ -0,0 +1,66 @@
+#!/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
+

In case you respin (due to other reasons), please add a second empty line before the "class" statement (that's the style that we use in the other tests, too).

Quoted 2 lines

Anyway:

Ping (not for 10.0)

Quoted 7 lines
Quoted 1 line

Peter, should this go through your arm tree, or shall I pick it up with other functional test patches for my next PR?

My preference would be like with previous Avocado tests: when a (functional) test concerns mostly a dedicated subsystem, I'd rather see the dedicated subsystem maintainers to take it, so they get familiar with the test. Except if the maintainers are busy or unresponsive of course.

Ping

#6 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 81 lines · Philippe Mathieu-Daudé

Hi Thomas,

Quoted 77 lines · Thomas Huth
Quoted 75 lines · Bernhard Beschow

Am 10. April 2025 06:05:35 UTC schrieb Thomas Huth <[email protected]>:

Quoted 68 lines · Bernhard Beschow
Quoted 54 lines

Introduce a functional test which boots Debian 12 on the imx8mp-evk board. Since
the root filesystem resides on an SD card, the test also verifies the basic
operation of the USDHC.

--
v2:
* Make test file executable (Thomas)
* Omit fetch() (Thomas)
* Omit "-accel tcg" (Thomas)
* Add "snapshot=on" to make potential future tests independent

Supersedes: [email protected]

---
   MAINTAINERS                                 |  1 +
   tests/functional/meson.build                |  1 +
   tests/functional/test_aarch64_imx8mp_evk.py | 66 ++++++++++++++++
+++++
   3 files changed, 68 insertions(+)

create mode 100755 tests/functional/test_aarch64_imx8mp_evk.py

MAINTAINERS +1 -0
index d54b5578f8..4ceffa89dc 100644
@@ -833,6 +833,7 @@ F: include/hw/arm/fsl-imx8mp.h
   F: include/hw/misc/imx8mp_*.h
   F: include/hw/pci-host/fsl_imx8m_phy.h
   F: docs/system/arm/imx8mp-evk.rst
+F: tests/functional/test_aarch64_imx8mp_evk.py
   F: tests/qtest/rs5c372-test.c
     MPS2 / MPS3
tests/functional/ renamed from tests/functional/meson.build +0 -0

meson.build
index 0f8be30fe2..aaaf3472f1 100644

tests/functional/meson.build +1 -0
@@ -75,6 +75,7 @@ tests_aarch64_system_quick = [
     tests_aarch64_system_thorough = [
     'aarch64_aspeed',
+  'aarch64_imx8mp_evk',
     'aarch64_raspi3',
     'aarch64_raspi4',
     'aarch64_replay',
tests/ renamed from tests/functional/test_aarch64_imx8mp_evk.py +0 -0

functional/test_aarch64_imx8mp_evk.py
new file mode 100755
index 0000000000..62fee74044

tests/functional/test_aarch64_imx8mp_evk.py line 8

Quoted 8 lines
tests/functional/test_aarch64_imx8mp_evk.py new file +8 -0
@@ -0,0 +1,66 @@
+#!/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
+

In case you respin (due to other reasons), please add a second empty line before the "class" statement (that's the style that we use in the other tests, too).

Quoted 2 lines

Anyway:

Ping (not for 10.0)

Quoted 8 lines
Quoted 2 lines

Peter, should this go through your arm tree, or shall I pick it up with other functional test patches for my next PR?

My preference would be like with previous Avocado tests: when a (functional) test concerns mostly a dedicated subsystem, I'd rather see the dedicated subsystem maintainers to take it, so they get familiar with the test. Except if the maintainers are busy or unresponsive of course.

I don't care much either way, and in this case I was away, so I'd have been happy for Thomas to take this via the test tree in my absence.

But I'm back again now, so I've applied this to target-arm.next.

Since on my machine it takes 42s to run on a clang-sanitizer build, and 96s on a debug build, I have added this to tests/functional/meson.build in the hope of avoiding timeouts on slow systems:

tests/functional/meson.build +1 -0
@@ -12,6 +12,7 @@ endif
 # Timeouts for individual tests that can be slow e.g. with debugging enabled
 test_timeouts = {
   'aarch64_aspeed' : 600,
+  'aarch64_imx8mp_evk' : 240,
   'aarch64_raspi4' : 480,
   'aarch64_reverse_debug' : 180,
   'aarch64_rme_virt' : 1200,

thanks
-- PMM