1#!/usr/bin/env python3 2# 3# Functional test that boots a Linux kernel and checks the console 4# 5# Copyright (c) 2018 Red Hat, Inc. 6# 7# Author: 8# Cleber Rosa <crosa@redhat.com> 9# 10# This work is licensed under the terms of the GNU GPL, version 2 or 11# later. See the COPYING file in the top-level directory. 12 13from qemu_test import QemuSystemTest, Asset 14from qemu_test import exec_command_and_wait_for_pattern 15from qemu_test import wait_for_console_pattern, skipFlakyTest 16 17 18class RxGdbSimMachine(QemuSystemTest): 19 20 timeout = 30 21 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' 22 23 ASSET_UBOOT = Asset( 24 'https://acc.dl.osdn.jp/users/23/23888/u-boot.bin.gz', 25 '7146567d669e91dbac166384b29aeba1715beb844c8551e904b86831bfd9d046') 26 ASSET_DTB = Asset( 27 'https://acc.dl.osdn.jp/users/23/23887/rx-virt.dtb', 28 'aa278d9c1907a4501741d7ee57e7f65c02dd1b3e0323b33c6d4247f1b32cf29a') 29 ASSET_KERNEL = Asset( 30 'http://acc.dl.osdn.jp/users/23/23845/zImage', 31 'baa43205e74a7220ed8482188c5e9ce497226712abb7f4e7e4f825ce19ff9656') 32 33 def test_uboot(self): 34 """ 35 U-Boot and checks that the console is operational. 36 """ 37 self.set_machine('gdbsim-r5f562n8') 38 39 uboot_path = self.uncompress(self.ASSET_UBOOT) 40 41 self.vm.set_console() 42 self.vm.add_args('-bios', uboot_path, 43 '-no-reboot') 44 self.vm.launch() 45 uboot_version = 'U-Boot 2016.05-rc3-23705-ga1ef3c71cb-dirty' 46 wait_for_console_pattern(self, uboot_version) 47 gcc_version = 'rx-unknown-linux-gcc (GCC) 9.0.0 20181105 (experimental)' 48 # FIXME limit baudrate on chardev, else we type too fast 49 # https://gitlab.com/qemu-project/qemu/-/issues/2691 50 #exec_command_and_wait_for_pattern(self, 'version', gcc_version) 51 52 @skipFlakyTest(bug_url="https://gitlab.com/qemu-project/qemu/-/issues/2691") 53 def test_linux_sash(self): 54 """ 55 Boots a Linux kernel and checks that the console is operational. 56 """ 57 self.set_machine('gdbsim-r5f562n7') 58 59 dtb_path = self.ASSET_DTB.fetch() 60 kernel_path = self.ASSET_KERNEL.fetch() 61 62 self.vm.set_console() 63 kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'earlycon' 64 self.vm.add_args('-kernel', kernel_path, 65 '-dtb', dtb_path, 66 '-no-reboot') 67 self.vm.launch() 68 wait_for_console_pattern(self, 'Sash command shell (version 1.1.1)', 69 failure_message='Kernel panic - not syncing') 70 exec_command_and_wait_for_pattern(self, 'printenv', 'TERM=linux') 71 72if __name__ == '__main__': 73 QemuSystemTest.main() 74