1438eff63SJamin Lin# Functional test that boots the ASPEED SoCs with firmware
2438eff63SJamin Lin#
3438eff63SJamin Lin# Copyright (C) 2022 ASPEED Technology Inc
4438eff63SJamin Lin#
5438eff63SJamin Lin# This work is licensed under the terms of the GNU GPL, version 2 or
6438eff63SJamin Lin# later.  See the COPYING file in the top-level directory.
7438eff63SJamin Lin
8f7bc7da0SCédric Le Goaterimport time
992f8e8e2SAlex Bennéeimport os
10f7bc7da0SCédric Le Goater
11438eff63SJamin Linfrom avocado_qemu import QemuSystemTest
12438eff63SJamin Linfrom avocado_qemu import wait_for_console_pattern
13f7bc7da0SCédric Le Goaterfrom avocado_qemu import exec_command
14438eff63SJamin Linfrom avocado_qemu import exec_command_and_wait_for_pattern
15a4b14b46SCédric Le Goaterfrom avocado_qemu import interrupt_interactive_console_until_pattern
16438eff63SJamin Linfrom avocado.utils import archive
1792f8e8e2SAlex Bennéefrom avocado import skipIf
18438eff63SJamin Lin
19438eff63SJamin Lin
20438eff63SJamin Linclass AST1030Machine(QemuSystemTest):
21438eff63SJamin Lin    """Boots the zephyr os and checks that the console is operational"""
22438eff63SJamin Lin
23438eff63SJamin Lin    timeout = 10
24438eff63SJamin Lin
2544055caaSPhilippe Mathieu-Daudé    def test_ast1030_zephyros_1_04(self):
26438eff63SJamin Lin        """
27438eff63SJamin Lin        :avocado: tags=arch:arm
28438eff63SJamin Lin        :avocado: tags=machine:ast1030-evb
2944055caaSPhilippe Mathieu-Daudé        :avocado: tags=os:zephyr
30438eff63SJamin Lin        """
31438eff63SJamin Lin        tar_url = ('https://github.com/AspeedTech-BMC'
32438eff63SJamin Lin                   '/zephyr/releases/download/v00.01.04/ast1030-evb-demo.zip')
33438eff63SJamin Lin        tar_hash = '4c6a8ce3a8ba76ef1a65dae419ae3409343c4b20'
34438eff63SJamin Lin        tar_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
35438eff63SJamin Lin        archive.extract(tar_path, self.workdir)
36438eff63SJamin Lin        kernel_file = self.workdir + "/ast1030-evb-demo/zephyr.elf"
37438eff63SJamin Lin        self.vm.set_console()
38438eff63SJamin Lin        self.vm.add_args('-kernel', kernel_file,
39438eff63SJamin Lin                         '-nographic')
40438eff63SJamin Lin        self.vm.launch()
41438eff63SJamin Lin        wait_for_console_pattern(self, "Booting Zephyr OS")
42438eff63SJamin Lin        exec_command_and_wait_for_pattern(self, "help",
43438eff63SJamin Lin                                          "Available commands")
44341e21faSCédric Le Goater
4544055caaSPhilippe Mathieu-Daudé    def test_ast1030_zephyros_1_07(self):
4644055caaSPhilippe Mathieu-Daudé        """
4744055caaSPhilippe Mathieu-Daudé        :avocado: tags=arch:arm
4844055caaSPhilippe Mathieu-Daudé        :avocado: tags=machine:ast1030-evb
4944055caaSPhilippe Mathieu-Daudé        :avocado: tags=os:zephyr
5044055caaSPhilippe Mathieu-Daudé        """
5144055caaSPhilippe Mathieu-Daudé        tar_url = ('https://github.com/AspeedTech-BMC'
5244055caaSPhilippe Mathieu-Daudé                   '/zephyr/releases/download/v00.01.07/ast1030-evb-demo.zip')
5344055caaSPhilippe Mathieu-Daudé        tar_hash = '40ac87eabdcd3b3454ce5aad11fedc72a33ecda2'
5444055caaSPhilippe Mathieu-Daudé        tar_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
5544055caaSPhilippe Mathieu-Daudé        archive.extract(tar_path, self.workdir)
5644055caaSPhilippe Mathieu-Daudé        kernel_file = self.workdir + "/ast1030-evb-demo/zephyr.bin"
5744055caaSPhilippe Mathieu-Daudé        self.vm.set_console()
5844055caaSPhilippe Mathieu-Daudé        self.vm.add_args('-kernel', kernel_file,
5944055caaSPhilippe Mathieu-Daudé                         '-nographic')
6044055caaSPhilippe Mathieu-Daudé        self.vm.launch()
6144055caaSPhilippe Mathieu-Daudé        wait_for_console_pattern(self, "Booting Zephyr OS")
6244055caaSPhilippe Mathieu-Daudé        for shell_cmd in [
6344055caaSPhilippe Mathieu-Daudé                'kernel stacks',
6444055caaSPhilippe Mathieu-Daudé                'otp info conf',
6544055caaSPhilippe Mathieu-Daudé                'otp info scu',
6644055caaSPhilippe Mathieu-Daudé                'hwinfo devid',
6744055caaSPhilippe Mathieu-Daudé                'crypto aes256_cbc_vault',
6844055caaSPhilippe Mathieu-Daudé                'random get',
6944055caaSPhilippe Mathieu-Daudé                'jtag JTAG1 sw_xfer high TMS',
7044055caaSPhilippe Mathieu-Daudé                'adc ADC0 resolution 12',
7144055caaSPhilippe Mathieu-Daudé                'adc ADC0 read 42',
7244055caaSPhilippe Mathieu-Daudé                'adc ADC1 read 69',
7344055caaSPhilippe Mathieu-Daudé                'i2c scan I2C_0',
7444055caaSPhilippe Mathieu-Daudé                'i3c attach I3C_0',
7544055caaSPhilippe Mathieu-Daudé                'hash test',
7644055caaSPhilippe Mathieu-Daudé                'kernel uptime',
7744055caaSPhilippe Mathieu-Daudé                'kernel reboot warm',
7844055caaSPhilippe Mathieu-Daudé                'kernel uptime',
7944055caaSPhilippe Mathieu-Daudé                'kernel reboot cold',
8044055caaSPhilippe Mathieu-Daudé                'kernel uptime',
8144055caaSPhilippe Mathieu-Daudé        ]: exec_command_and_wait_for_pattern(self, shell_cmd, "uart:~$")
8244055caaSPhilippe Mathieu-Daudé
83341e21faSCédric Le Goaterclass AST2x00Machine(QemuSystemTest):
84341e21faSCédric Le Goater
85b1ceae2fSAlex Bennée    timeout = 90
86b1ceae2fSAlex Bennée
87341e21faSCédric Le Goater    def wait_for_console_pattern(self, success_message, vm=None):
88341e21faSCédric Le Goater        wait_for_console_pattern(self, success_message,
89341e21faSCédric Le Goater                                 failure_message='Kernel panic - not syncing',
90341e21faSCédric Le Goater                                 vm=vm)
91341e21faSCédric Le Goater
92341e21faSCédric Le Goater    def do_test_arm_aspeed(self, image):
93341e21faSCédric Le Goater        self.vm.set_console()
94341e21faSCédric Le Goater        self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
95341e21faSCédric Le Goater                         '-net', 'nic')
96341e21faSCédric Le Goater        self.vm.launch()
97341e21faSCédric Le Goater
98341e21faSCédric Le Goater        self.wait_for_console_pattern("U-Boot 2016.07")
99341e21faSCédric Le Goater        self.wait_for_console_pattern("## Loading kernel from FIT Image at 20080000")
100341e21faSCédric Le Goater        self.wait_for_console_pattern("Starting kernel ...")
101341e21faSCédric Le Goater        self.wait_for_console_pattern("Booting Linux on physical CPU 0x0")
102341e21faSCédric Le Goater        wait_for_console_pattern(self,
103341e21faSCédric Le Goater                "aspeed-smc 1e620000.spi: read control register: 203b0641")
104341e21faSCédric Le Goater        self.wait_for_console_pattern("ftgmac100 1e660000.ethernet eth0: irq ")
105341e21faSCédric Le Goater        self.wait_for_console_pattern("systemd[1]: Set hostname to")
106341e21faSCédric Le Goater
107341e21faSCédric Le Goater    def test_arm_ast2400_palmetto_openbmc_v2_9_0(self):
108341e21faSCédric Le Goater        """
109341e21faSCédric Le Goater        :avocado: tags=arch:arm
110341e21faSCédric Le Goater        :avocado: tags=machine:palmetto-bmc
111341e21faSCédric Le Goater        """
112341e21faSCédric Le Goater
113341e21faSCédric Le Goater        image_url = ('https://github.com/openbmc/openbmc/releases/download/2.9.0/'
114341e21faSCédric Le Goater                     'obmc-phosphor-image-palmetto.static.mtd')
115341e21faSCédric Le Goater        image_hash = ('3e13bbbc28e424865dc42f35ad672b10f2e82cdb11846bb28fa625b48beafd0d')
116341e21faSCédric Le Goater        image_path = self.fetch_asset(image_url, asset_hash=image_hash,
117341e21faSCédric Le Goater                                      algorithm='sha256')
118341e21faSCédric Le Goater
119341e21faSCédric Le Goater        self.do_test_arm_aspeed(image_path)
120341e21faSCédric Le Goater
121341e21faSCédric Le Goater    def test_arm_ast2500_romulus_openbmc_v2_9_0(self):
122341e21faSCédric Le Goater        """
123341e21faSCédric Le Goater        :avocado: tags=arch:arm
124341e21faSCédric Le Goater        :avocado: tags=machine:romulus-bmc
125341e21faSCédric Le Goater        """
126341e21faSCédric Le Goater
127341e21faSCédric Le Goater        image_url = ('https://github.com/openbmc/openbmc/releases/download/2.9.0/'
128341e21faSCédric Le Goater                     'obmc-phosphor-image-romulus.static.mtd')
129341e21faSCédric Le Goater        image_hash = ('820341076803f1955bc31e647a512c79f9add4f5233d0697678bab4604c7bb25')
130341e21faSCédric Le Goater        image_path = self.fetch_asset(image_url, asset_hash=image_hash,
131341e21faSCédric Le Goater                                      algorithm='sha256')
132341e21faSCédric Le Goater
133341e21faSCédric Le Goater        self.do_test_arm_aspeed(image_path)
134f7bc7da0SCédric Le Goater
1357b5093b8SCédric Le Goater    def do_test_arm_aspeed_buildroot_start(self, image, cpu_id):
1360793fe01SPeter Maydell        self.require_netdev('user')
1370793fe01SPeter Maydell
138f7bc7da0SCédric Le Goater        self.vm.set_console()
139f7bc7da0SCédric Le Goater        self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
140f7bc7da0SCédric Le Goater                         '-net', 'nic', '-net', 'user')
141f7bc7da0SCédric Le Goater        self.vm.launch()
142f7bc7da0SCédric Le Goater
143f7bc7da0SCédric Le Goater        self.wait_for_console_pattern('U-Boot 2019.04')
144f7bc7da0SCédric Le Goater        self.wait_for_console_pattern('## Loading kernel from FIT Image')
145f7bc7da0SCédric Le Goater        self.wait_for_console_pattern('Starting kernel ...')
146f7bc7da0SCédric Le Goater        self.wait_for_console_pattern('Booting Linux on physical CPU ' + cpu_id)
147f7bc7da0SCédric Le Goater        self.wait_for_console_pattern('lease of 10.0.2.15')
14865711f9aSAlex Bennée        # the line before login:
149f7bc7da0SCédric Le Goater        self.wait_for_console_pattern('Aspeed EVB')
15065711f9aSAlex Bennée        time.sleep(0.1)
151f7bc7da0SCédric Le Goater        exec_command(self, 'root')
152f7bc7da0SCédric Le Goater        time.sleep(0.1)
153f7bc7da0SCédric Le Goater
1547b5093b8SCédric Le Goater    def do_test_arm_aspeed_buildroot_poweroff(self):
155f7bc7da0SCédric Le Goater        exec_command_and_wait_for_pattern(self, 'poweroff',
156f7bc7da0SCédric Le Goater                                          'reboot: System halted');
157f7bc7da0SCédric Le Goater
1587b5093b8SCédric Le Goater    def test_arm_ast2500_evb_buildroot(self):
159f7bc7da0SCédric Le Goater        """
160f7bc7da0SCédric Le Goater        :avocado: tags=arch:arm
161f7bc7da0SCédric Le Goater        :avocado: tags=machine:ast2500-evb
162f7bc7da0SCédric Le Goater        """
163f7bc7da0SCédric Le Goater
164f7bc7da0SCédric Le Goater        image_url = ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
165ed1f5ff8SCédric Le Goater                     'images/ast2500-evb/buildroot-2022.11-2-g15d3648df9/flash.img')
166ed1f5ff8SCédric Le Goater        image_hash = ('f96d11db521fe7a2787745e9e391225deeeec3318ee0fc07c8b799b8833dd474')
167f7bc7da0SCédric Le Goater        image_path = self.fetch_asset(image_url, asset_hash=image_hash,
168f7bc7da0SCédric Le Goater                                      algorithm='sha256')
169f7bc7da0SCédric Le Goater
1707a7308eaSCédric Le Goater        self.vm.add_args('-device',
1717a7308eaSCédric Le Goater                         'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
1727b5093b8SCédric Le Goater        self.do_test_arm_aspeed_buildroot_start(image_path, '0x0')
1737a7308eaSCédric Le Goater
1747a7308eaSCédric Le Goater        exec_command_and_wait_for_pattern(self,
1757a7308eaSCédric Le Goater             'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
1767a7308eaSCédric Le Goater             'i2c i2c-3: new_device: Instantiated device lm75 at 0x4d');
1777a7308eaSCédric Le Goater        exec_command_and_wait_for_pattern(self,
1787a7308eaSCédric Le Goater                             'cat /sys/class/hwmon/hwmon1/temp1_input', '0')
1797a7308eaSCédric Le Goater        self.vm.command('qom-set', path='/machine/peripheral/tmp-test',
1807a7308eaSCédric Le Goater                        property='temperature', value=18000);
1817a7308eaSCédric Le Goater        exec_command_and_wait_for_pattern(self,
1827a7308eaSCédric Le Goater                             'cat /sys/class/hwmon/hwmon1/temp1_input', '18000')
1837a7308eaSCédric Le Goater
1847b5093b8SCédric Le Goater        self.do_test_arm_aspeed_buildroot_poweroff()
185f7bc7da0SCédric Le Goater
1867b5093b8SCédric Le Goater    def test_arm_ast2600_evb_buildroot(self):
187f7bc7da0SCédric Le Goater        """
188f7bc7da0SCédric Le Goater        :avocado: tags=arch:arm
189f7bc7da0SCédric Le Goater        :avocado: tags=machine:ast2600-evb
190f7bc7da0SCédric Le Goater        """
191f7bc7da0SCédric Le Goater
192f7bc7da0SCédric Le Goater        image_url = ('https://github.com/legoater/qemu-aspeed-boot/raw/master/'
193ed1f5ff8SCédric Le Goater                     'images/ast2600-evb/buildroot-2022.11-2-g15d3648df9/flash.img')
194ed1f5ff8SCédric Le Goater        image_hash = ('e598d86e5ea79671ca8b59212a326c911bc8bea728dec1a1f5390d717a28bb8b')
195f7bc7da0SCédric Le Goater        image_path = self.fetch_asset(image_url, asset_hash=image_hash,
196f7bc7da0SCédric Le Goater                                      algorithm='sha256')
197f7bc7da0SCédric Le Goater
19861cf757dSCédric Le Goater        self.vm.add_args('-device',
19961cf757dSCédric Le Goater                         'tmp105,bus=aspeed.i2c.bus.3,address=0x4d,id=tmp-test');
2003302184fSCédric Le Goater        self.vm.add_args('-device',
2013302184fSCédric Le Goater                         'ds1338,bus=aspeed.i2c.bus.3,address=0x32');
202*82e94da5SCédric Le Goater        self.vm.add_args('-device',
203*82e94da5SCédric Le Goater                         'i2c-echo,bus=aspeed.i2c.bus.3,address=0x42');
2047b5093b8SCédric Le Goater        self.do_test_arm_aspeed_buildroot_start(image_path, '0xf00')
20561cf757dSCédric Le Goater
20661cf757dSCédric Le Goater        exec_command_and_wait_for_pattern(self,
20761cf757dSCédric Le Goater             'echo lm75 0x4d > /sys/class/i2c-dev/i2c-3/device/new_device',
20861cf757dSCédric Le Goater             'i2c i2c-3: new_device: Instantiated device lm75 at 0x4d');
20961cf757dSCédric Le Goater        exec_command_and_wait_for_pattern(self,
21061cf757dSCédric Le Goater                             'cat /sys/class/hwmon/hwmon0/temp1_input', '0')
21161cf757dSCédric Le Goater        self.vm.command('qom-set', path='/machine/peripheral/tmp-test',
21261cf757dSCédric Le Goater                        property='temperature', value=18000);
21361cf757dSCédric Le Goater        exec_command_and_wait_for_pattern(self,
21461cf757dSCédric Le Goater                             'cat /sys/class/hwmon/hwmon0/temp1_input', '18000')
21561cf757dSCédric Le Goater
2163302184fSCédric Le Goater        exec_command_and_wait_for_pattern(self,
2173302184fSCédric Le Goater             'echo ds1307 0x32 > /sys/class/i2c-dev/i2c-3/device/new_device',
2183302184fSCédric Le Goater             'i2c i2c-3: new_device: Instantiated device ds1307 at 0x32');
2193302184fSCédric Le Goater        year = time.strftime("%Y")
2203302184fSCédric Le Goater        exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year);
2213302184fSCédric Le Goater
222*82e94da5SCédric Le Goater        exec_command_and_wait_for_pattern(self,
223*82e94da5SCédric Le Goater             'echo slave-24c02 0x1064 > /sys/bus/i2c/devices/i2c-3/new_device',
224*82e94da5SCédric Le Goater             'i2c i2c-3: new_device: Instantiated device slave-24c02 at 0x64');
225*82e94da5SCédric Le Goater        exec_command(self, 'i2cset -y 3 0x42 0x64 0x00 0xaa i');
226*82e94da5SCédric Le Goater        time.sleep(0.1)
227*82e94da5SCédric Le Goater        exec_command_and_wait_for_pattern(self,
228*82e94da5SCédric Le Goater             'hexdump /sys/bus/i2c/devices/3-1064/slave-eeprom',
229*82e94da5SCédric Le Goater             '0000000 ffaa ffff ffff ffff ffff ffff ffff ffff');
2307b5093b8SCédric Le Goater        self.do_test_arm_aspeed_buildroot_poweroff()
231bceb4d99SCédric Le Goater
232bceb4d99SCédric Le Goater
23392f8e8e2SAlex Bennéeclass AST2x00MachineSDK(QemuSystemTest):
23492f8e8e2SAlex Bennée
23530d7aac4SCédric Le Goater    EXTRA_BOOTARGS = (
23630d7aac4SCédric Le Goater        'quiet '
23730d7aac4SCédric Le Goater        'systemd.mask=org.openbmc.HostIpmi.service '
23830d7aac4SCédric Le Goater        'systemd.mask=xyz.openbmc_project.Chassis.Control.Power@0.service '
23930d7aac4SCédric Le Goater        'systemd.mask=modprobe@fuse.service '
24030d7aac4SCédric Le Goater        'systemd.mask=rngd.service '
24130d7aac4SCédric Le Goater        'systemd.mask=obmc-console@ttyS2.service '
24230d7aac4SCédric Le Goater    )
243a4b14b46SCédric Le Goater
24492f8e8e2SAlex Bennée    # FIXME: Although these tests boot a whole distro they are still
24592f8e8e2SAlex Bennée    # slower than comparable machine models. There may be some
24692f8e8e2SAlex Bennée    # optimisations which bring down the runtime. In the meantime they
24792f8e8e2SAlex Bennée    # have generous timeouts and are disable for CI which aims for all
24892f8e8e2SAlex Bennée    # tests to run in less than 60 seconds.
24992f8e8e2SAlex Bennée    timeout = 240
25092f8e8e2SAlex Bennée
25192f8e8e2SAlex Bennée    def wait_for_console_pattern(self, success_message, vm=None):
25292f8e8e2SAlex Bennée        wait_for_console_pattern(self, success_message,
25392f8e8e2SAlex Bennée                                 failure_message='Kernel panic - not syncing',
25492f8e8e2SAlex Bennée                                 vm=vm)
25592f8e8e2SAlex Bennée
256a4b14b46SCédric Le Goater    def do_test_arm_aspeed_sdk_start(self, image):
2570793fe01SPeter Maydell        self.require_netdev('user')
258bceb4d99SCédric Le Goater        self.vm.set_console()
259bceb4d99SCédric Le Goater        self.vm.add_args('-drive', 'file=' + image + ',if=mtd,format=raw',
260bceb4d99SCédric Le Goater                         '-net', 'nic', '-net', 'user')
261bceb4d99SCédric Le Goater        self.vm.launch()
262bceb4d99SCédric Le Goater
263bceb4d99SCédric Le Goater        self.wait_for_console_pattern('U-Boot 2019.04')
264a4b14b46SCédric Le Goater        interrupt_interactive_console_until_pattern(
265a4b14b46SCédric Le Goater            self, 'Hit any key to stop autoboot:', 'ast#')
266a4b14b46SCédric Le Goater        exec_command_and_wait_for_pattern(
267a4b14b46SCédric Le Goater            self, 'setenv bootargs ${bootargs} ' + self.EXTRA_BOOTARGS, 'ast#')
268a4b14b46SCédric Le Goater        exec_command_and_wait_for_pattern(
269a4b14b46SCédric Le Goater            self, 'boot', '## Loading kernel from FIT Image')
270bceb4d99SCédric Le Goater        self.wait_for_console_pattern('Starting kernel ...')
271bceb4d99SCédric Le Goater
27292f8e8e2SAlex Bennée    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
273bceb4d99SCédric Le Goater    def test_arm_ast2500_evb_sdk(self):
274bceb4d99SCédric Le Goater        """
275bceb4d99SCédric Le Goater        :avocado: tags=arch:arm
276bceb4d99SCédric Le Goater        :avocado: tags=machine:ast2500-evb
277bceb4d99SCédric Le Goater        """
278bceb4d99SCédric Le Goater
279bceb4d99SCédric Le Goater        image_url = ('https://github.com/AspeedTech-BMC/openbmc/releases/'
280bceb4d99SCédric Le Goater                     'download/v08.01/ast2500-default-obmc.tar.gz')
281bceb4d99SCédric Le Goater        image_hash = ('5375f82b4c43a79427909342a1e18b4e48bd663e38466862145d27bb358796fd')
282bceb4d99SCédric Le Goater        image_path = self.fetch_asset(image_url, asset_hash=image_hash,
283bceb4d99SCédric Le Goater                                      algorithm='sha256')
284bceb4d99SCédric Le Goater        archive.extract(image_path, self.workdir)
285bceb4d99SCédric Le Goater
286bceb4d99SCédric Le Goater        self.do_test_arm_aspeed_sdk_start(
287a4b14b46SCédric Le Goater            self.workdir + '/ast2500-default/image-bmc')
288bceb4d99SCédric Le Goater        self.wait_for_console_pattern('ast2500-default login:')
289bceb4d99SCédric Le Goater
29092f8e8e2SAlex Bennée    @skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
291bceb4d99SCédric Le Goater    def test_arm_ast2600_evb_sdk(self):
292bceb4d99SCédric Le Goater        """
293bceb4d99SCédric Le Goater        :avocado: tags=arch:arm
294bceb4d99SCédric Le Goater        :avocado: tags=machine:ast2600-evb
295bceb4d99SCédric Le Goater        """
296bceb4d99SCédric Le Goater
297bceb4d99SCédric Le Goater        image_url = ('https://github.com/AspeedTech-BMC/openbmc/releases/'
298bceb4d99SCédric Le Goater                     'download/v08.01/ast2600-default-obmc.tar.gz')
299bceb4d99SCédric Le Goater        image_hash = ('f12ef15e8c1f03a214df3b91c814515c5e2b2f56119021398c1dbdd626817d15')
300bceb4d99SCédric Le Goater        image_path = self.fetch_asset(image_url, asset_hash=image_hash,
301bceb4d99SCédric Le Goater                                      algorithm='sha256')
302bceb4d99SCédric Le Goater        archive.extract(image_path, self.workdir)
303bceb4d99SCédric Le Goater
304bceb4d99SCédric Le Goater        self.vm.add_args('-device',
305bceb4d99SCédric Le Goater                         'tmp105,bus=aspeed.i2c.bus.5,address=0x4d,id=tmp-test');
306bceb4d99SCédric Le Goater        self.vm.add_args('-device',
307bceb4d99SCédric Le Goater                         'ds1338,bus=aspeed.i2c.bus.5,address=0x32');
308bceb4d99SCédric Le Goater        self.do_test_arm_aspeed_sdk_start(
309a4b14b46SCédric Le Goater            self.workdir + '/ast2600-default/image-bmc')
310bceb4d99SCédric Le Goater        self.wait_for_console_pattern('ast2600-default login:')
311bceb4d99SCédric Le Goater        exec_command_and_wait_for_pattern(self, 'root', 'Password:')
312bceb4d99SCédric Le Goater        exec_command_and_wait_for_pattern(self, '0penBmc', 'root@ast2600-default:~#')
313bceb4d99SCédric Le Goater
314bceb4d99SCédric Le Goater        exec_command_and_wait_for_pattern(self,
315bceb4d99SCédric Le Goater             'echo lm75 0x4d > /sys/class/i2c-dev/i2c-5/device/new_device',
316bceb4d99SCédric Le Goater             'i2c i2c-5: new_device: Instantiated device lm75 at 0x4d');
317bceb4d99SCédric Le Goater        exec_command_and_wait_for_pattern(self,
318bceb4d99SCédric Le Goater                             'cat /sys/class/hwmon/hwmon19/temp1_input', '0')
319bceb4d99SCédric Le Goater        self.vm.command('qom-set', path='/machine/peripheral/tmp-test',
320bceb4d99SCédric Le Goater                        property='temperature', value=18000);
321bceb4d99SCédric Le Goater        exec_command_and_wait_for_pattern(self,
322bceb4d99SCédric Le Goater                             'cat /sys/class/hwmon/hwmon19/temp1_input', '18000')
323bceb4d99SCédric Le Goater
324bceb4d99SCédric Le Goater        exec_command_and_wait_for_pattern(self,
325bceb4d99SCédric Le Goater             'echo ds1307 0x32 > /sys/class/i2c-dev/i2c-5/device/new_device',
326bceb4d99SCédric Le Goater             'i2c i2c-5: new_device: Instantiated device ds1307 at 0x32');
327bceb4d99SCédric Le Goater        year = time.strftime("%Y")
328bceb4d99SCédric Le Goater        exec_command_and_wait_for_pattern(self, 'hwclock -f /dev/rtc1', year);
329