1*a94bfe1bSThomas Huth#!/usr/bin/env python3 2*a94bfe1bSThomas Huth# 3*a94bfe1bSThomas Huth# Boot a Linux kernel on a r2d sh4 machine and check the console 4*a94bfe1bSThomas Huth# 5*a94bfe1bSThomas Huth# SPDX-License-Identifier: GPL-2.0-or-later 6*a94bfe1bSThomas Huth 7*a94bfe1bSThomas Huthimport os 8*a94bfe1bSThomas Huth 9*a94bfe1bSThomas Huthfrom qemu_test import LinuxKernelTest, Asset 10*a94bfe1bSThomas Huthfrom qemu_test.utils import archive_extract 11*a94bfe1bSThomas Huthfrom unittest import skipUnless 12*a94bfe1bSThomas Huth 13*a94bfe1bSThomas Huthclass R2dTest(LinuxKernelTest): 14*a94bfe1bSThomas Huth 15*a94bfe1bSThomas Huth ASSET_DAY09 = Asset( 16*a94bfe1bSThomas Huth 'https://www.qemu-advent-calendar.org/2018/download/day09.tar.xz', 17*a94bfe1bSThomas Huth 'a61b44d2630a739d1380cc4ff4b80981d47ccfd5992f1484ccf48322c35f09ac') 18*a94bfe1bSThomas Huth 19*a94bfe1bSThomas Huth # This test has a 6-10% failure rate on various hosts that look 20*a94bfe1bSThomas Huth # like issues with a buggy kernel. 21*a94bfe1bSThomas Huth @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is unstable') 22*a94bfe1bSThomas Huth def test_r2d(self): 23*a94bfe1bSThomas Huth self.set_machine('r2d') 24*a94bfe1bSThomas Huth file_path = self.ASSET_DAY09.fetch() 25*a94bfe1bSThomas Huth archive_extract(file_path, self.workdir) 26*a94bfe1bSThomas Huth self.vm.add_args('-append', 'console=ttySC1') 27*a94bfe1bSThomas Huth self.launch_kernel(self.workdir + '/day09/zImage', console_index=1, 28*a94bfe1bSThomas Huth wait_for='QEMU advent calendar') 29*a94bfe1bSThomas Huth 30*a94bfe1bSThomas Huthif __name__ == '__main__': 31*a94bfe1bSThomas Huth LinuxKernelTest.main() 32