hw/arm/fsl-imx8mm: Adding functional testing of iMX8MM emulation
Added script that would validate the iMX8MM emulation by checking the linux console log. If it succeeds, it will return:- ok 1 test_imx8mm_evk.Imx8mmEvkMachine.test_aarch64_imx8mm_evk_usdhc Signed-off-by: Gaurav Sharma <gaurav.sharma_7@nxp.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Bernhard Beschow <shentey@gmail.com> [PMM: Add missing blank lines that flake8 wants] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Gaurav Sharma committed
Apr 21, 2026 at 12:22 UTC
a97b7ad6b6f7debf2e463356cad65b0aaa53aabc
3 files changed
+72
MAINTAINERS
+1
@@ -921,6 +921,7 @@ F: hw/arm/fsl-imx8mm.c
921
F: hw/arm/imx8mm-evk.c
922
F: include/hw/arm/fsl-imx8mm.h
923
F: docs/system/arm/imx8m.rst
924
+F: tests/functional/aarch64/test_imx8mm_evk.py
925
926
MCIMX8MP-EVK / i.MX8MP
927
M: Bernhard Beschow <shentey@gmail.com>
tests/functional/aarch64/meson.build
+2
@@ -5,6 +5,7 @@ test_aarch64_timeouts = {
5
'aspeed_ast2700a2' : 600,
6
'aspeed_ast2700fc' : 600,
7
'device_passthrough' : 720,
8
+ 'imx8mm_evk' : 240,
9
'imx8mp_evk' : 240,
10
'raspi4' : 480,
11
'reverse_debug' : 180,
@@ -29,6 +30,7 @@ tests_aarch64_system_thorough = [
30
'aspeed_ast2700fc',
31
'device_passthrough',
32
'hotplug_pci',
33
+ 'imx8mm_evk',
34
'imx8mp_evk',
35
'kvm',
36
'multiprocess',
tests/functional/aarch64/test_imx8mm_evk.py
new
+69
@@ -0,0 +1,69 @@
1
+#!/usr/bin/env python3
2
+#
3
+# Functional test that boots a Linux kernel and checks the console
4
+#
5
+# SPDX-License-Identifier: GPL-2.0-or-later
6
+
7
+from qemu_test import LinuxKernelTest, Asset
8
+
9
+
10
+class Imx8mmEvkMachine(LinuxKernelTest):
11
+
12
+ ASSET_IMAGE = Asset(
13
+ ('https://cloud.debian.org/images/cloud/bookworm/20231210-1590/'
14
+ 'debian-12-generic-arm64-20231210-1590.tar.xz'),
15
+ '7ebf1577b32d5af6204df74b54ca2e4675de9b5a9fa14f3ff70b88eeb7b3b359')
16
+
17
+ KERNEL_OFFSET = 0x51000000
18
+ KERNEL_SIZE = 32622528
19
+ INITRD_OFFSET = 0x76000000
20
+ INITRD_SIZE = 30987766
21
+ DTB_OFFSET = 0x64DB5000
22
+ DTB_SIZE = 36812
23
+
24
+ def extract(self, in_path, out_path, offset, size):
25
+ try:
26
+ with open(in_path, "rb") as source:
27
+ source.seek(offset)
28
+ data = source.read(size)
29
+ with open(out_path, "wb") as target:
30
+ target.write(data)
31
+ except (IOError, ValueError) as e:
32
+ self.log.error(f"Failed to extract {out_path}: {e}")
33
+ raise
34
+
35
+ def setUp(self):
36
+ super().setUp()
37
+
38
+ self.image_path = self.scratch_file("disk.raw")
39
+ self.kernel_path = self.scratch_file("linux")
40
+ self.initrd_path = self.scratch_file("initrd.zstd")
41
+ self.dtb_path = self.scratch_file("imx8mm-evk.dtb")
42
+
43
+ self.archive_extract(self.ASSET_IMAGE)
44
+ self.extract(self.image_path, self.kernel_path,
45
+ self.KERNEL_OFFSET, self.KERNEL_SIZE)
46
+ self.extract(self.image_path, self.initrd_path,
47
+ self.INITRD_OFFSET, self.INITRD_SIZE)
48
+ self.extract(self.image_path, self.dtb_path,
49
+ self.DTB_OFFSET, self.DTB_SIZE)
50
+
51
+ def test_aarch64_imx8mm_evk_usdhc(self):
52
+ self.require_accelerator("tcg")
53
+ self.set_machine('imx8mm-evk')
54
+ self.vm.set_console(console_index=1)
55
+ self.vm.add_args('-m', '2G',
56
+ '-smp', '4',
57
+ '-kernel', self.kernel_path,
58
+ '-initrd', self.initrd_path,
59
+ '-dtb', self.dtb_path,
60
+ '-append', 'root=/dev/mmcblk2p1',
61
+ '-drive', f'file={self.image_path},if=sd,bus=2,'
62
+ 'format=raw,id=mmcblk2,snapshot=on')
63
+
64
+ self.vm.launch()
65
+ self.wait_for_console_pattern('Welcome to ')
66
+
67
+
68
+if __name__ == '__main__':
69
+ LinuxKernelTest.main()