1#!/usr/bin/env python3
2#
3# Functional test that boots the ASPEED machines
4#
5# SPDX-License-Identifier: GPL-2.0-or-later
6
7from qemu_test import Asset
8from qemu_test.aspeed import AspeedTest
9
10class RainierMachine(AspeedTest):
11
12    ASSET_RAINIER_EMMC = Asset(
13        ('https://fileserver.linaro.org/s/B6pJTwWEkzSDi36/download/'
14         'mmc-p10bmc-20240617.qcow2'),
15        'd523fb478d2b84d5adc5658d08502bc64b1486955683814f89c6137518acd90b')
16
17    def test_arm_aspeed_emmc_boot(self):
18        self.set_machine('rainier-bmc')
19        self.require_netdev('user')
20
21        image_path = self.ASSET_RAINIER_EMMC.fetch()
22
23        self.vm.set_console()
24        self.vm.add_args('-drive',
25                         'file=' + image_path + ',if=sd,id=sd2,index=2',
26                         '-net', 'nic', '-net', 'user', '-snapshot')
27        self.vm.launch()
28
29        self.wait_for_console_pattern('U-Boot SPL 2019.04')
30        self.wait_for_console_pattern('Trying to boot from MMC1')
31        self.wait_for_console_pattern('U-Boot 2019.04')
32        self.wait_for_console_pattern('eMMC 2nd Boot')
33        self.wait_for_console_pattern('## Loading kernel from FIT Image')
34        self.wait_for_console_pattern('Starting kernel ...')
35        self.wait_for_console_pattern('Booting Linux on physical CPU 0xf00')
36        self.wait_for_console_pattern('mmcblk0: p1 p2 p3 p4 p5 p6 p7')
37        self.wait_for_console_pattern('IBM eBMC (OpenBMC for IBM Enterprise')
38
39if __name__ == '__main__':
40    AspeedTest.main()
41