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