| 1 | #!/usr/bin/env python3 |
| 2 | # |
| 3 | # QEMU AVR integration tests |
| 4 | # |
| 5 | # Copyright (c) 2019-2020 Michael Rolnik <mrolnik@gmail.com> |
| 6 | # |
| 7 | # This program is free software: you can redistribute it and/or modify |
| 8 | # it under the terms of the GNU General Public License as published by |
| 9 | # the Free Software Foundation, either version 2 of the License, or |
| 10 | # (at your option) any later version. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | # |
| 20 | |
| 21 | from qemu_test import QemuSystemTest, Asset, wait_for_console_pattern |
| 22 | |
| 23 | |
| 24 | class AVR6Machine(QemuSystemTest): |
| 25 | |
| 26 | ASSET_ROM = Asset(('https://github.com/seharris/qemu-avr-tests' |
| 27 | '/raw/36c3e67b8755dcf/free-rtos/Demo' |
| 28 | '/AVR_ATMega2560_GCC/demo.elf'), |
| 29 | 'ee4833bd65fc69e84a79ed1c608affddbd499a60e63acf87d9113618401904e4') |
| 30 | |
| 31 | def test_freertos(self): |
| 32 | """ |
| 33 | https://github.com/seharris/qemu-avr-tests/raw/master/free-rtos/Demo/AVR_ATMega2560_GCC/demo.elf |
| 34 | constantly prints out 'ABCDEFGHIJKLMNOPQRSTUVWXABCDEFGHIJKLMNOPQRSTUVWX' |
| 35 | """ |
| 36 | rom_path = self.ASSET_ROM.fetch() |
| 37 | |
| 38 | self.set_machine('arduino-mega-2560-v3') |
| 39 | self.vm.add_args('-bios', rom_path) |
| 40 | self.vm.add_args('-nographic') |
| 41 | self.vm.set_console() |
| 42 | self.vm.launch() |
| 43 | |
| 44 | wait_for_console_pattern(self, |
| 45 | 'XABCDEFGHIJKLMNOPQRSTUVWXABCDEFGHIJKLMNOPQRSTUVWXA') |
| 46 | |
| 47 | |
| 48 | if __name__ == '__main__': |
| 49 | QemuSystemTest.main() |