xref: /qemu/tests/functional/test_arm_aspeed_ast2500.py (revision 513823e7521a09ed7ad1e32e6454bac3b2cbf52d)
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 aspeed import AspeedTest
9from qemu_test import exec_command_and_wait_for_pattern
10
11
12class AST2500Machine(AspeedTest):
13
14    ASSET_BR2_202411_AST2500_FLASH = Asset(
15        ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
16         'images/ast2500-evb/buildroot-2024.11/flash.img'),
17        '641e6906c18c0f19a2aeb48099d66d4771929c361001d554d0d45c667413e13a')
18
19    def test_arm_ast2500_evb_buildroot(self):
20        self.set_machine('ast2500-evb')
21
22        image_path = self.ASSET_BR2_202411_AST2500_FLASH.fetch()
23
24        self.vm.add_args('-device',
25                         'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
26        self.do_test_arm_aspeed_buildroot_start(image_path, '0x0',
27                                                'ast2500-evb login:')
28
29        exec_command_and_wait_for_pattern(self,
30             'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
31             'i2c i2c-3: new_device: Instantiated device lm75 at 0x4d');
32        exec_command_and_wait_for_pattern(self,
33                             'cat /sys/class/hwmon/hwmon1/temp1_input', '0')
34        self.vm.cmd('qom-set', path='/machine/peripheral/tmp-test',
35                    property='temperature', value=18000);
36        exec_command_and_wait_for_pattern(self,
37                             'cat /sys/class/hwmon/hwmon1/temp1_input', '18000')
38
39        self.do_test_arm_aspeed_buildroot_poweroff()
40
41    ASSET_SDK_V806_AST2500 = Asset(
42        'https://github.com/AspeedTech-BMC/openbmc/releases/download/v08.06/ast2500-default-obmc.tar.gz',
43        'e1755f3cadff69190438c688d52dd0f0d399b70a1e14b1d3d5540fc4851d38ca')
44
45    def test_arm_ast2500_evb_sdk(self):
46        self.set_machine('ast2500-evb')
47
48        self.archive_extract(self.ASSET_SDK_V806_AST2500)
49
50        self.do_test_arm_aspeed_sdk_start(
51            self.scratch_file("ast2500-default", "image-bmc"))
52
53        self.wait_for_console_pattern('ast2500-default login:')
54
55
56if __name__ == '__main__':
57    AspeedTest.main()
58