1#!/usr/bin/env python3
2#
3# Functional test that boots a Linux kernel on an Alpha Clipper machine
4# and checks the console
5#
6# SPDX-License-Identifier: GPL-2.0-or-later
7
8import os
9
10from qemu_test import LinuxKernelTest, Asset
11from qemu_test.utils import gzip_uncompress
12
13
14class AlphaClipperTest(LinuxKernelTest):
15
16    ASSET_KERNEL = Asset(
17        ('http://archive.debian.org/debian/dists/lenny/main/'
18         'installer-alpha/20090123lenny10/images/cdrom/vmlinuz'),
19        '34f53da3fa32212e4f00b03cb944b2ad81c06bc8faaf9b7193b2e544ceeca576')
20
21    def test_alpha_clipper(self):
22        self.set_machine('clipper')
23        kernel_path = self.ASSET_KERNEL.fetch()
24
25        uncompressed_kernel = os.path.join(self.workdir, 'vmlinux')
26        gzip_uncompress(kernel_path, uncompressed_kernel)
27
28        self.vm.set_console()
29        kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
30        self.vm.add_args('-nodefaults',
31                         '-kernel', uncompressed_kernel,
32                         '-append', kernel_command_line)
33        self.vm.launch()
34        console_pattern = 'Kernel command line: %s' % kernel_command_line
35        self.wait_for_console_pattern(console_pattern)
36
37if __name__ == '__main__':
38    LinuxKernelTest.main()
39