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