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