| 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 | |
| 7 | from qemu_test import Asset, exec_command_and_wait_for_pattern |
| 8 | from aspeed import AspeedTest |
| 9 | |
| 10 | |
| 11 | class AST2500Machine(AspeedTest): |
| 12 | |
| 13 | ASSET_BR2_202511_AST2500_FLASH = Asset( |
| 14 | ('https://github.com/legoater/qemu-aspeed-boot/raw/master/' |
| 15 | 'images/ast2500-evb/buildroot-2025.11/flash.img'), |
| 16 | '31e5a8e280b982fb0e7c07eb71c94851002f99ac604dfe620e71a5d47cc87e78') |
| 17 | |
| 18 | def test_arm_ast2500_evb_buildroot(self): |
| 19 | self.set_machine('ast2500-evb') |
| 20 | |
| 21 | image_path = self.ASSET_BR2_202511_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 | |
| 41 | if __name__ == '__main__': |
| 42 | AspeedTest.main() |