xref: /qemu/tests/functional/test_sh4eb_r2d.py (revision beaf88c895a5eda649777757c80ab4171de777ff)
162728ddcSThomas Huth#!/usr/bin/env python3
262728ddcSThomas Huth#
362728ddcSThomas Huth# Boot a Linux kernel on a r2d sh4eb machine and check the console
462728ddcSThomas Huth#
562728ddcSThomas Huth# SPDX-License-Identifier: GPL-2.0-or-later
662728ddcSThomas Huth
762728ddcSThomas Huthimport shutil
862728ddcSThomas Huth
962728ddcSThomas Huthfrom qemu_test import LinuxKernelTest, Asset
1062728ddcSThomas Huthfrom qemu_test import exec_command_and_wait_for_pattern
1162728ddcSThomas Huthfrom qemu_test.utils import archive_extract
1262728ddcSThomas Huth
1362728ddcSThomas Huthclass R2dEBTest(LinuxKernelTest):
1462728ddcSThomas Huth
1562728ddcSThomas Huth    ASSET_TGZ = Asset(
1662728ddcSThomas Huth        'https://landley.net/bin/mkroot/0.8.11/sh4eb.tgz',
1762728ddcSThomas Huth        'be8c6cb5aef8406899dc5aa5e22b6aa45840eb886cdd3ced51555c10577ada2c')
1862728ddcSThomas Huth
1962728ddcSThomas Huth    def test_sh4eb_r2d(self):
2062728ddcSThomas Huth        self.set_machine('r2d')
2162728ddcSThomas Huth        file_path = self.ASSET_TGZ.fetch()
2262728ddcSThomas Huth        archive_extract(file_path, self.workdir)
2362728ddcSThomas Huth        self.vm.add_args('-append', 'console=ttySC1 noiotrap')
24*beaf88c8SDaniel P. Berrangé        self.launch_kernel(self.scratch_file('sh4eb', 'linux-kernel'),
25*beaf88c8SDaniel P. Berrangé                           initrd=self.scratch_file('sh4eb',
26*beaf88c8SDaniel P. Berrangé                                                    'initramfs.cpio.gz'),
2762728ddcSThomas Huth                           console_index=1, wait_for='Type exit when done')
2862728ddcSThomas Huth        exec_command_and_wait_for_pattern(self, 'exit', 'Restarting system')
29*beaf88c8SDaniel P. Berrangé        shutil.rmtree(self.scratch_file('sh4eb'))
3062728ddcSThomas Huth
3162728ddcSThomas Huthif __name__ == '__main__':
3262728ddcSThomas Huth    LinuxKernelTest.main()
33