xref: /qemu/tests/functional/test_arm_aspeed_rainier.py (revision 5831ed84e7e450a652f215721aba34ed4e1ffb97)
1f04cb2d0SCédric Le Goater#!/usr/bin/env python3
2f04cb2d0SCédric Le Goater#
338cd5c52SCédric Le Goater# Functional test that boots the ASPEED machines
4f04cb2d0SCédric Le Goater#
5f04cb2d0SCédric Le Goater# SPDX-License-Identifier: GPL-2.0-or-later
6f04cb2d0SCédric Le Goater
738cd5c52SCédric Le Goaterfrom qemu_test import Asset
838cd5c52SCédric Le Goaterfrom aspeed import AspeedTest
9f04cb2d0SCédric Le Goater
1038cd5c52SCédric Le Goaterclass RainierMachine(AspeedTest):
11f04cb2d0SCédric Le Goater
12f04cb2d0SCédric Le Goater    ASSET_RAINIER_EMMC = Asset(
13f04cb2d0SCédric Le Goater        ('https://fileserver.linaro.org/s/B6pJTwWEkzSDi36/download/'
14f04cb2d0SCédric Le Goater         'mmc-p10bmc-20240617.qcow2'),
15f04cb2d0SCédric Le Goater        'd523fb478d2b84d5adc5658d08502bc64b1486955683814f89c6137518acd90b')
16f04cb2d0SCédric Le Goater
17f04cb2d0SCédric Le Goater    def test_arm_aspeed_emmc_boot(self):
18f04cb2d0SCédric Le Goater        self.set_machine('rainier-bmc')
19f04cb2d0SCédric Le Goater        self.require_netdev('user')
20f04cb2d0SCédric Le Goater
21f04cb2d0SCédric Le Goater        image_path = self.ASSET_RAINIER_EMMC.fetch()
22f04cb2d0SCédric Le Goater
23f04cb2d0SCédric Le Goater        self.vm.set_console()
24f04cb2d0SCédric Le Goater        self.vm.add_args('-drive',
25f04cb2d0SCédric Le Goater                         'file=' + image_path + ',if=sd,id=sd2,index=2',
26f04cb2d0SCédric Le Goater                         '-net', 'nic', '-net', 'user', '-snapshot')
27f04cb2d0SCédric Le Goater        self.vm.launch()
28f04cb2d0SCédric Le Goater
29f04cb2d0SCédric Le Goater        self.wait_for_console_pattern('U-Boot SPL 2019.04')
30f04cb2d0SCédric Le Goater        self.wait_for_console_pattern('Trying to boot from MMC1')
31f04cb2d0SCédric Le Goater        self.wait_for_console_pattern('U-Boot 2019.04')
32f04cb2d0SCédric Le Goater        self.wait_for_console_pattern('eMMC 2nd Boot')
33f04cb2d0SCédric Le Goater        self.wait_for_console_pattern('## Loading kernel from FIT Image')
34f04cb2d0SCédric Le Goater        self.wait_for_console_pattern('Starting kernel ...')
35f04cb2d0SCédric Le Goater        self.wait_for_console_pattern('Booting Linux on physical CPU 0xf00')
36f04cb2d0SCédric Le Goater        self.wait_for_console_pattern('mmcblk0: p1 p2 p3 p4 p5 p6 p7')
37f04cb2d0SCédric Le Goater        self.wait_for_console_pattern('IBM eBMC (OpenBMC for IBM Enterprise')
38f04cb2d0SCédric Le Goater
393cbbd9cbSCédric Le Goater    ASSET_DEBIAN_LINUX_ARMHF_DEB = Asset(
403cbbd9cbSCédric Le Goater            ('http://snapshot.debian.org/archive/debian/20220606T211338Z/pool/main/l/linux/linux-image-5.17.0-2-armmp_5.17.6-1%2Bb1_armhf.deb'),
413cbbd9cbSCédric Le Goater        '8acb2b4439faedc2f3ed4bdb2847ad4f6e0491f73debaeb7f660c8abe4dcdc0e')
423cbbd9cbSCédric Le Goater
433cbbd9cbSCédric Le Goater    def test_arm_debian_kernel_boot(self):
443cbbd9cbSCédric Le Goater        self.set_machine('rainier-bmc')
453cbbd9cbSCédric Le Goater
46*5831ed84SDaniel P. Berrangé        kernel_path = self.archive_extract(
47*5831ed84SDaniel P. Berrangé            self.ASSET_DEBIAN_LINUX_ARMHF_DEB,
48*5831ed84SDaniel P. Berrangé            member='boot/vmlinuz-5.17.0-2-armmp')
49*5831ed84SDaniel P. Berrangé        dtb_path = self.archive_extract(
50*5831ed84SDaniel P. Berrangé            self.ASSET_DEBIAN_LINUX_ARMHF_DEB,
51*5831ed84SDaniel P. Berrangé            member='usr/lib/linux-image-5.17.0-2-armmp/aspeed-bmc-ibm-rainier.dtb')
523cbbd9cbSCédric Le Goater
533cbbd9cbSCédric Le Goater        self.vm.set_console()
543cbbd9cbSCédric Le Goater        self.vm.add_args('-kernel', kernel_path,
553cbbd9cbSCédric Le Goater                         '-dtb', dtb_path,
563cbbd9cbSCédric Le Goater                         '-net', 'nic')
573cbbd9cbSCédric Le Goater        self.vm.launch()
583cbbd9cbSCédric Le Goater
593cbbd9cbSCédric Le Goater        self.wait_for_console_pattern("Booting Linux on physical CPU 0xf00")
603cbbd9cbSCédric Le Goater        self.wait_for_console_pattern("SMP: Total of 2 processors activated")
613cbbd9cbSCédric Le Goater        self.wait_for_console_pattern("No filesystem could mount root")
623cbbd9cbSCédric Le Goater
633cbbd9cbSCédric Le Goater
64f04cb2d0SCédric Le Goaterif __name__ == '__main__':
6538cd5c52SCédric Le Goater    AspeedTest.main()
66