]> git.proxmox.com Git - mirror_qemu.git/blame - tests/avocado/machine_aspeed.py
test/avocado/machine_aspeed.py: Move OpenBMC tests
[mirror_qemu.git] / tests / avocado / machine_aspeed.py
CommitLineData
438eff63
JL
1# Functional test that boots the ASPEED SoCs with firmware
2#
3# Copyright (C) 2022 ASPEED Technology Inc
4#
5# This work is licensed under the terms of the GNU GPL, version 2 or
6# later. See the COPYING file in the top-level directory.
7
8from avocado_qemu import QemuSystemTest
9from avocado_qemu import wait_for_console_pattern
10from avocado_qemu import exec_command_and_wait_for_pattern
11from avocado.utils import archive
12
13
14class AST1030Machine(QemuSystemTest):
15 """Boots the zephyr os and checks that the console is operational"""
16
17 timeout = 10
18
19 def test_ast1030_zephyros(self):
20 """
21 :avocado: tags=arch:arm
22 :avocado: tags=machine:ast1030-evb
23 """
24 tar_url = ('https://github.com/AspeedTech-BMC'
25 '/zephyr/releases/download/v00.01.04/ast1030-evb-demo.zip')
26 tar_hash = '4c6a8ce3a8ba76ef1a65dae419ae3409343c4b20'
27 tar_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
28 archive.extract(tar_path, self.workdir)
29 kernel_file = self.workdir + "/ast1030-evb-demo/zephyr.elf"
30 self.vm.set_console()
31 self.vm.add_args('-kernel', kernel_file,
32 '-nographic')
33 self.vm.launch()
34 wait_for_console_pattern(self, "Booting Zephyr OS")
35 exec_command_and_wait_for_pattern(self, "help",
36 "Available commands")
341e21fa
CLG
37
38class AST2x00Machine(QemuSystemTest):
39
40 def wait_for_console_pattern(self, success_message, vm=None):
41 wait_for_console_pattern(self, success_message,
42 failure_message='Kernel panic - not syncing',
43 vm=vm)
44
45 def do_test_arm_aspeed(self, image):
46 self.vm.set_console()
47 self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
48 '-net', 'nic')
49 self.vm.launch()
50
51 self.wait_for_console_pattern("U-Boot 2016.07")
52 self.wait_for_console_pattern("## Loading kernel from FIT Image at 20080000")
53 self.wait_for_console_pattern("Starting kernel ...")
54 self.wait_for_console_pattern("Booting Linux on physical CPU 0x0")
55 wait_for_console_pattern(self,
56 "aspeed-smc 1e620000.spi: read control register: 203b0641")
57 self.wait_for_console_pattern("ftgmac100 1e660000.ethernet eth0: irq ")
58 self.wait_for_console_pattern("systemd[1]: Set hostname to")
59
60 def test_arm_ast2400_palmetto_openbmc_v2_9_0(self):
61 """
62 :avocado: tags=arch:arm
63 :avocado: tags=machine:palmetto-bmc
64 """
65
66 image_url = ('https://github.com/openbmc/openbmc/releases/download/2.9.0/'
67 'obmc-phosphor-image-palmetto.static.mtd')
68 image_hash = ('3e13bbbc28e424865dc42f35ad672b10f2e82cdb11846bb28fa625b48beafd0d')
69 image_path = self.fetch_asset(image_url, asset_hash=image_hash,
70 algorithm='sha256')
71
72 self.do_test_arm_aspeed(image_path)
73
74 def test_arm_ast2500_romulus_openbmc_v2_9_0(self):
75 """
76 :avocado: tags=arch:arm
77 :avocado: tags=machine:romulus-bmc
78 """
79
80 image_url = ('https://github.com/openbmc/openbmc/releases/download/2.9.0/'
81 'obmc-phosphor-image-romulus.static.mtd')
82 image_hash = ('820341076803f1955bc31e647a512c79f9add4f5233d0697678bab4604c7bb25')
83 image_path = self.fetch_asset(image_url, asset_hash=image_hash,
84 algorithm='sha256')
85
86 self.do_test_arm_aspeed(image_path)