xref: /qemu/tests/functional/test_avr_uno.py (revision a8b5c10c7147ebc992de12fdc3f25a219f5c742f)
1*ff1bc6f4SThomas Huth#!/usr/bin/env python3
2*ff1bc6f4SThomas Huth#
3*ff1bc6f4SThomas Huth# QEMU AVR Arduino UNO functional test
4*ff1bc6f4SThomas Huth#
5*ff1bc6f4SThomas Huth# SPDX-License-Identifier: GPL-2.0-or-later
6*ff1bc6f4SThomas Huth
7*ff1bc6f4SThomas Huthfrom qemu_test import QemuSystemTest, Asset, wait_for_console_pattern
8*ff1bc6f4SThomas Huth
9*ff1bc6f4SThomas Huth
10*ff1bc6f4SThomas Huthclass UnoMachine(QemuSystemTest):
11*ff1bc6f4SThomas Huth
12*ff1bc6f4SThomas Huth    ASSET_UNO = Asset(
13*ff1bc6f4SThomas Huth        ('https://github.com/RahulRNandan/LED_Blink_AVR/raw/'
14*ff1bc6f4SThomas Huth         'c6d602cbb974a193/build/main.elf'),
15*ff1bc6f4SThomas Huth        '3009a4e2cf5c5b65142f538abdf66d4dc6bc6beab7e552fff9ae314583761b72')
16*ff1bc6f4SThomas Huth
17*ff1bc6f4SThomas Huth    def test_uno(self):
18*ff1bc6f4SThomas Huth        """
19*ff1bc6f4SThomas Huth        The binary constantly prints out 'LED Blink'
20*ff1bc6f4SThomas Huth        """
21*ff1bc6f4SThomas Huth        self.set_machine('arduino-uno')
22*ff1bc6f4SThomas Huth        rom_path = self.ASSET_UNO.fetch()
23*ff1bc6f4SThomas Huth
24*ff1bc6f4SThomas Huth        self.vm.add_args('-bios', rom_path)
25*ff1bc6f4SThomas Huth        self.vm.set_console()
26*ff1bc6f4SThomas Huth        self.vm.launch()
27*ff1bc6f4SThomas Huth
28*ff1bc6f4SThomas Huth        wait_for_console_pattern(self, 'LED Blink')
29*ff1bc6f4SThomas Huth
30*ff1bc6f4SThomas Huth
31*ff1bc6f4SThomas Huthif __name__ == '__main__':
32*ff1bc6f4SThomas Huth    QemuSystemTest.main()
33