xref: /qemu/tests/functional/test_arm_aspeed_ast2500.py (revision 5831ed84e7e450a652f215721aba34ed4e1ffb97)
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
10*5831ed84SDaniel P. Berrangé
1108743dbaSCédric Le Goater
1208743dbaSCédric Le Goaterclass AST2500Machine(AspeedTest):
1308743dbaSCédric Le Goater
1408743dbaSCédric Le Goater    ASSET_BR2_202311_AST2500_FLASH = Asset(
1508743dbaSCédric Le Goater        ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
1608743dbaSCédric Le Goater         'images/ast2500-evb/buildroot-2023.11/flash.img'),
1708743dbaSCédric Le Goater        'c23db6160cf77d0258397eb2051162c8473a56c441417c52a91ba217186e715f')
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
2208743dbaSCédric Le Goater        image_path = self.ASSET_BR2_202311_AST2500_FLASH.fetch()
2308743dbaSCédric Le Goater
2408743dbaSCédric Le Goater        self.vm.add_args('-device',
2508743dbaSCédric Le Goater                         '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',
3108743dbaSCédric Le Goater             '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',
3508743dbaSCédric Le Goater                    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
48*5831ed84SDaniel 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