xref: /qemu/tests/functional/test_arm_aspeed_rainier.py (revision c7bc9cab3f5e2c0f807d801d09d0bbe95c4ce825)
1#!/usr/bin/env python3
2#
3# Functional test that boots the ASPEED SoCs with firmware
4#
5# Copyright (C) 2022 ASPEED Technology Inc
6#
7# SPDX-License-Identifier: GPL-2.0-or-later
8
9import os
10import time
11import subprocess
12import tempfile
13
14from qemu_test import LinuxKernelTest, Asset
15from qemu_test import exec_command_and_wait_for_pattern
16from qemu_test import interrupt_interactive_console_until_pattern
17from qemu_test import has_cmd
18from qemu_test.utils import archive_extract
19from zipfile import ZipFile
20from unittest import skipUnless
21
22class AST2x00MachineMMC(LinuxKernelTest):
23
24    ASSET_RAINIER_EMMC = Asset(
25        ('https://fileserver.linaro.org/s/B6pJTwWEkzSDi36/download/'
26         'mmc-p10bmc-20240617.qcow2'),
27        'd523fb478d2b84d5adc5658d08502bc64b1486955683814f89c6137518acd90b')
28
29    def test_arm_aspeed_emmc_boot(self):
30        self.set_machine('rainier-bmc')
31        self.require_netdev('user')
32
33        image_path = self.ASSET_RAINIER_EMMC.fetch()
34
35        self.vm.set_console()
36        self.vm.add_args('-drive',
37                         'file=' + image_path + ',if=sd,id=sd2,index=2',
38                         '-net', 'nic', '-net', 'user', '-snapshot')
39        self.vm.launch()
40
41        self.wait_for_console_pattern('U-Boot SPL 2019.04')
42        self.wait_for_console_pattern('Trying to boot from MMC1')
43        self.wait_for_console_pattern('U-Boot 2019.04')
44        self.wait_for_console_pattern('eMMC 2nd Boot')
45        self.wait_for_console_pattern('## Loading kernel from FIT Image')
46        self.wait_for_console_pattern('Starting kernel ...')
47        self.wait_for_console_pattern('Booting Linux on physical CPU 0xf00')
48        self.wait_for_console_pattern('mmcblk0: p1 p2 p3 p4 p5 p6 p7')
49        self.wait_for_console_pattern('IBM eBMC (OpenBMC for IBM Enterprise')
50
51if __name__ == '__main__':
52    LinuxKernelTest.main()
53