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