| 1 | #!/usr/bin/env python3 |
| 2 | # |
| 3 | # Functional test that checks the serial console of the stellaris machines |
| 4 | # |
| 5 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 6 | |
| 7 | from qemu_test import QemuSystemTest, Asset, exec_command_and_wait_for_pattern |
| 8 | from qemu_test import wait_for_console_pattern |
| 9 | |
| 10 | |
| 11 | class StellarisMachine(QemuSystemTest): |
| 12 | |
| 13 | ASSET_DAY22 = Asset( |
| 14 | 'https://www.qemu-advent-calendar.org/2023/download/day22.tar.gz', |
| 15 | 'ae3a63ef4b7a22c21bfc7fc0d85e402fe95e223308ed23ac854405016431ff51') |
| 16 | |
| 17 | def test_lm3s6965evb(self): |
| 18 | self.set_machine('lm3s6965evb') |
| 19 | kernel_path = self.archive_extract(self.ASSET_DAY22, |
| 20 | member='day22/day22.bin') |
| 21 | self.vm.set_console() |
| 22 | self.vm.add_args('-kernel', kernel_path) |
| 23 | self.vm.launch() |
| 24 | |
| 25 | wait_for_console_pattern(self, 'In a one horse open') |
| 26 | |
| 27 | ASSET_NOTMAIN = Asset( |
| 28 | 'https://github.com/Ahelion/QemuArmM4FDemoSw/raw/master/build/notmain.bin', |
| 29 | '6ceda031aa081a420fca2fca9e137fa681d6e3820d820ad1917736cb265e611a') |
| 30 | |
| 31 | def test_lm3s811evb(self): |
| 32 | self.set_machine('lm3s811evb') |
| 33 | kernel_path = self.ASSET_NOTMAIN.fetch() |
| 34 | |
| 35 | self.vm.set_console() |
| 36 | self.vm.add_args('-cpu', 'cortex-m4') |
| 37 | self.vm.add_args('-kernel', kernel_path) |
| 38 | self.vm.launch() |
| 39 | |
| 40 | # The test kernel emits an initial '!' and then waits for input. |
| 41 | # For each character that we send it responds with a certain |
| 42 | # other ASCII character. |
| 43 | wait_for_console_pattern(self, '!') |
| 44 | exec_command_and_wait_for_pattern(self, '789', 'cdf') |
| 45 | |
| 46 | |
| 47 | if __name__ == '__main__': |
| 48 | QemuSystemTest.main() |