xref: /qemu/tests/functional/test_arm_aspeed_ast2500.py (revision 08743dbaa12e0e3c1622bfcdd6cbb7eb03d51ffb)
1*08743dbaSCédric Le Goater#!/usr/bin/env python3
2*08743dbaSCédric Le Goater#
3*08743dbaSCédric Le Goater# Functional test that boots the ASPEED machines
4*08743dbaSCédric Le Goater#
5*08743dbaSCédric Le Goater# SPDX-License-Identifier: GPL-2.0-or-later
6*08743dbaSCédric Le Goater
7*08743dbaSCédric Le Goaterfrom qemu_test import Asset
8*08743dbaSCédric Le Goaterfrom aspeed import AspeedTest
9*08743dbaSCédric Le Goaterfrom qemu_test import exec_command_and_wait_for_pattern
10*08743dbaSCédric Le Goaterfrom qemu_test.utils import archive_extract
11*08743dbaSCédric Le Goater
12*08743dbaSCédric Le Goaterclass AST2500Machine(AspeedTest):
13*08743dbaSCédric Le Goater
14*08743dbaSCédric Le Goater    ASSET_BR2_202311_AST2500_FLASH = Asset(
15*08743dbaSCédric Le Goater        ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
16*08743dbaSCédric Le Goater         'images/ast2500-evb/buildroot-2023.11/flash.img'),
17*08743dbaSCédric Le Goater        'c23db6160cf77d0258397eb2051162c8473a56c441417c52a91ba217186e715f')
18*08743dbaSCédric Le Goater
19*08743dbaSCédric Le Goater    def test_arm_ast2500_evb_buildroot(self):
20*08743dbaSCédric Le Goater        self.set_machine('ast2500-evb')
21*08743dbaSCédric Le Goater
22*08743dbaSCédric Le Goater        image_path = self.ASSET_BR2_202311_AST2500_FLASH.fetch()
23*08743dbaSCédric Le Goater
24*08743dbaSCédric Le Goater        self.vm.add_args('-device',
25*08743dbaSCédric Le Goater                         'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
26*08743dbaSCédric Le Goater        self.do_test_arm_aspeed_buildroot_start(image_path, '0x0',
27*08743dbaSCédric Le Goater                                                'ast2500-evb login:')
28*08743dbaSCédric Le Goater
29*08743dbaSCédric Le Goater        exec_command_and_wait_for_pattern(self,
30*08743dbaSCédric Le Goater             'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
31*08743dbaSCédric Le Goater             'i2c i2c-3: new_device: Instantiated device lm75 at 0x4d');
32*08743dbaSCédric Le Goater        exec_command_and_wait_for_pattern(self,
33*08743dbaSCédric Le Goater                             'cat /sys/class/hwmon/hwmon1/temp1_input', '0')
34*08743dbaSCédric Le Goater        self.vm.cmd('qom-set', path='/machine/peripheral/tmp-test',
35*08743dbaSCédric Le Goater                    property='temperature', value=18000);
36*08743dbaSCédric Le Goater        exec_command_and_wait_for_pattern(self,
37*08743dbaSCédric Le Goater                             'cat /sys/class/hwmon/hwmon1/temp1_input', '18000')
38*08743dbaSCédric Le Goater
39*08743dbaSCédric Le Goater        self.do_test_arm_aspeed_buildroot_poweroff()
40*08743dbaSCédric Le Goater
41*08743dbaSCédric Le Goater    ASSET_SDK_V806_AST2500 = Asset(
42*08743dbaSCédric Le Goater        'https://github.com/AspeedTech-BMC/openbmc/releases/download/v08.06/ast2500-default-obmc.tar.gz',
43*08743dbaSCédric Le Goater        'e1755f3cadff69190438c688d52dd0f0d399b70a1e14b1d3d5540fc4851d38ca')
44*08743dbaSCédric Le Goater
45*08743dbaSCédric Le Goater    def test_arm_ast2500_evb_sdk(self):
46*08743dbaSCédric Le Goater        self.set_machine('ast2500-evb')
47*08743dbaSCédric Le Goater
48*08743dbaSCédric Le Goater        image_path = self.ASSET_SDK_V806_AST2500.fetch()
49*08743dbaSCédric Le Goater
50*08743dbaSCédric Le Goater        archive_extract(image_path, self.workdir)
51*08743dbaSCédric Le Goater
52*08743dbaSCédric Le Goater        self.do_test_arm_aspeed_sdk_start(
53*08743dbaSCédric Le Goater            self.workdir + '/ast2500-default/image-bmc')
54*08743dbaSCédric Le Goater
55*08743dbaSCédric Le Goater        self.wait_for_console_pattern('ast2500-default login:')
56*08743dbaSCédric Le Goater
57*08743dbaSCédric Le Goater
58*08743dbaSCédric Le Goaterif __name__ == '__main__':
59*08743dbaSCédric Le Goater    AspeedTest.main()
60