xref: /qemu/tests/functional/test_sh4eb_r2d.py (revision e923f5e1b853ac80e96b416143300af9d189af8e)
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 os
8import shutil
9
10from qemu_test import LinuxKernelTest, Asset
11from qemu_test import exec_command_and_wait_for_pattern
12from qemu_test.utils import archive_extract
13
14class R2dEBTest(LinuxKernelTest):
15
16    ASSET_TGZ = Asset(
17        'https://landley.net/bin/mkroot/0.8.11/sh4eb.tgz',
18        'be8c6cb5aef8406899dc5aa5e22b6aa45840eb886cdd3ced51555c10577ada2c')
19
20    def test_sh4eb_r2d(self):
21        self.set_machine('r2d')
22        file_path = self.ASSET_TGZ.fetch()
23        archive_extract(file_path, self.workdir)
24        self.vm.add_args('-append', 'console=ttySC1 noiotrap')
25        self.launch_kernel(os.path.join(self.workdir, 'sh4eb/linux-kernel'),
26                           initrd=os.path.join(self.workdir, 'sh4eb/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(os.path.join(self.workdir, 'sh4eb'))
30
31if __name__ == '__main__':
32    LinuxKernelTest.main()
33