xref: /qemu/tests/functional/test_sh4eb_r2d.py (revision beaf88c895a5eda649777757c80ab4171de777ff)
1#!/usr/bin/env python3
2#
3# Boot a Linux kernel on a r2d sh4eb machine and check the console
4#
5# SPDX-License-Identifier: GPL-2.0-or-later
6
7import shutil
8
9from qemu_test import LinuxKernelTest, Asset
10from qemu_test import exec_command_and_wait_for_pattern
11from qemu_test.utils import archive_extract
12
13class R2dEBTest(LinuxKernelTest):
14
15    ASSET_TGZ = Asset(
16        'https://landley.net/bin/mkroot/0.8.11/sh4eb.tgz',
17        'be8c6cb5aef8406899dc5aa5e22b6aa45840eb886cdd3ced51555c10577ada2c')
18
19    def test_sh4eb_r2d(self):
20        self.set_machine('r2d')
21        file_path = self.ASSET_TGZ.fetch()
22        archive_extract(file_path, self.workdir)
23        self.vm.add_args('-append', 'console=ttySC1 noiotrap')
24        self.launch_kernel(self.scratch_file('sh4eb', 'linux-kernel'),
25                           initrd=self.scratch_file('sh4eb',
26                                                    'initramfs.cpio.gz'),
27                           console_index=1, wait_for='Type exit when done')
28        exec_command_and_wait_for_pattern(self, 'exit', 'Restarting system')
29        shutil.rmtree(self.scratch_file('sh4eb'))
30
31if __name__ == '__main__':
32    LinuxKernelTest.main()
33