1*e3fc99b1SThomas Huth#!/usr/bin/env python3 2*e3fc99b1SThomas Huth# 3*e3fc99b1SThomas Huth# Functional test that boots a Linux kernel and checks the console 4*e3fc99b1SThomas Huth# 5*e3fc99b1SThomas Huth# Copyright (c) 2020 Red Hat, Inc. 6*e3fc99b1SThomas Huth# 7*e3fc99b1SThomas Huth# Author: 8*e3fc99b1SThomas Huth# Thomas Huth <thuth@redhat.com> 9*e3fc99b1SThomas Huth# 10*e3fc99b1SThomas Huth# This work is licensed under the terms of the GNU GPL, version 2 or 11*e3fc99b1SThomas Huth# later. See the COPYING file in the top-level directory. 12*e3fc99b1SThomas Huth 13*e3fc99b1SThomas Huthimport os 14*e3fc99b1SThomas Huth 15*e3fc99b1SThomas Huthfrom qemu_test import QemuSystemTest, Asset 16*e3fc99b1SThomas Huthfrom qemu_test import wait_for_console_pattern 17*e3fc99b1SThomas Huthfrom qemu_test.utils import archive_extract 18*e3fc99b1SThomas Huth 19*e3fc99b1SThomas Huthclass Sun4uMachine(QemuSystemTest): 20*e3fc99b1SThomas Huth """Boots the Linux kernel and checks that the console is operational""" 21*e3fc99b1SThomas Huth 22*e3fc99b1SThomas Huth timeout = 90 23*e3fc99b1SThomas Huth 24*e3fc99b1SThomas Huth ASSET_IMAGE = Asset( 25*e3fc99b1SThomas Huth ('https://qemu-advcal.gitlab.io/qac-best-of-multiarch/download/' 26*e3fc99b1SThomas Huth 'day23.tar.xz'), 27*e3fc99b1SThomas Huth 'a3ed92450704af244178351afd0e769776e7decb298e95a63abfd9a6e3f6c854') 28*e3fc99b1SThomas Huth 29*e3fc99b1SThomas Huth def test_sparc64_sun4u(self): 30*e3fc99b1SThomas Huth self.set_machine('sun4u') 31*e3fc99b1SThomas Huth file_path = self.ASSET_IMAGE.fetch() 32*e3fc99b1SThomas Huth kernel_name = 'day23/vmlinux' 33*e3fc99b1SThomas Huth archive_extract(file_path, self.workdir, kernel_name) 34*e3fc99b1SThomas Huth self.vm.set_console() 35*e3fc99b1SThomas Huth self.vm.add_args('-kernel', os.path.join(self.workdir, kernel_name), 36*e3fc99b1SThomas Huth '-append', 'printk.time=0') 37*e3fc99b1SThomas Huth self.vm.launch() 38*e3fc99b1SThomas Huth wait_for_console_pattern(self, 'Starting logging: OK') 39*e3fc99b1SThomas Huth 40*e3fc99b1SThomas Huthif __name__ == '__main__': 41*e3fc99b1SThomas Huth QemuSystemTest.main() 42