xref: /qemu/tests/functional/test_arm_aspeed_ast2500.py (revision 858640eaee9f3039580118f5629825825cea311a)
108743dbaSCédric Le Goater#!/usr/bin/env python3
208743dbaSCédric Le Goater#
308743dbaSCédric Le Goater# Functional test that boots the ASPEED machines
408743dbaSCédric Le Goater#
508743dbaSCédric Le Goater# SPDX-License-Identifier: GPL-2.0-or-later
608743dbaSCédric Le Goater
708743dbaSCédric Le Goaterfrom qemu_test import Asset
808743dbaSCédric Le Goaterfrom aspeed import AspeedTest
908743dbaSCédric Le Goaterfrom qemu_test import exec_command_and_wait_for_pattern
105831ed84SDaniel P. Berrangé
1108743dbaSCédric Le Goater
1208743dbaSCédric Le Goaterclass AST2500Machine(AspeedTest):
1308743dbaSCédric Le Goater
14f7ae9612SCédric Le Goater    ASSET_BR2_202411_AST2500_FLASH = Asset(
1508743dbaSCédric Le Goater        ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
16f7ae9612SCédric Le Goater         'images/ast2500-evb/buildroot-2024.11/flash.img'),
17f7ae9612SCédric Le Goater        '641e6906c18c0f19a2aeb48099d66d4771929c361001d554d0d45c667413e13a')
1808743dbaSCédric Le Goater
1908743dbaSCédric Le Goater    def test_arm_ast2500_evb_buildroot(self):
2008743dbaSCédric Le Goater        self.set_machine('ast2500-evb')
2108743dbaSCédric Le Goater
22f7ae9612SCédric Le Goater        image_path = self.ASSET_BR2_202411_AST2500_FLASH.fetch()
2308743dbaSCédric Le Goater
2408743dbaSCédric Le Goater        self.vm.add_args('-device',
25*858640eaSThomas Huth                         'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test')
2608743dbaSCédric Le Goater        self.do_test_arm_aspeed_buildroot_start(image_path, '0x0',
2708743dbaSCédric Le Goater                                                'ast2500-evb login:')
2808743dbaSCédric Le Goater
2908743dbaSCédric Le Goater        exec_command_and_wait_for_pattern(self,
3008743dbaSCédric Le Goater             'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
31*858640eaSThomas Huth             'i2c i2c-3: new_device: Instantiated device lm75 at 0x4d')
3208743dbaSCédric Le Goater        exec_command_and_wait_for_pattern(self,
3308743dbaSCédric Le Goater                             'cat /sys/class/hwmon/hwmon1/temp1_input', '0')
3408743dbaSCédric Le Goater        self.vm.cmd('qom-set', path='/machine/peripheral/tmp-test',
35*858640eaSThomas Huth                    property='temperature', value=18000)
3608743dbaSCédric Le Goater        exec_command_and_wait_for_pattern(self,
3708743dbaSCédric Le Goater                             'cat /sys/class/hwmon/hwmon1/temp1_input', '18000')
3808743dbaSCédric Le Goater
3908743dbaSCédric Le Goater        self.do_test_arm_aspeed_buildroot_poweroff()
4008743dbaSCédric Le Goater
4108743dbaSCédric Le Goater    ASSET_SDK_V806_AST2500 = Asset(
4208743dbaSCédric Le Goater        'https://github.com/AspeedTech-BMC/openbmc/releases/download/v08.06/ast2500-default-obmc.tar.gz',
4308743dbaSCédric Le Goater        'e1755f3cadff69190438c688d52dd0f0d399b70a1e14b1d3d5540fc4851d38ca')
4408743dbaSCédric Le Goater
4508743dbaSCédric Le Goater    def test_arm_ast2500_evb_sdk(self):
4608743dbaSCédric Le Goater        self.set_machine('ast2500-evb')
4708743dbaSCédric Le Goater
485831ed84SDaniel P. Berrangé        self.archive_extract(self.ASSET_SDK_V806_AST2500)
4908743dbaSCédric Le Goater
5008743dbaSCédric Le Goater        self.do_test_arm_aspeed_sdk_start(
51beaf88c8SDaniel P. Berrangé            self.scratch_file("ast2500-default", "image-bmc"))
5208743dbaSCédric Le Goater
5308743dbaSCédric Le Goater        self.wait_for_console_pattern('ast2500-default login:')
5408743dbaSCédric Le Goater
5508743dbaSCédric Le Goater
5608743dbaSCédric Le Goaterif __name__ == '__main__':
5708743dbaSCédric Le Goater    AspeedTest.main()
58