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