1# Functional test that boots a Linux kernel and checks the console
2#
3# Copyright (c) 2020 Red Hat, Inc.
4#
5# Author:
6#  Thomas Huth <thuth@redhat.com>
7#
8# This work is licensed under the terms of the GNU GPL, version 2 or
9# later.  See the COPYING file in the top-level directory.
10
11import os
12
13from avocado import skipUnless
14from avocado_qemu import QemuSystemTest
15from avocado_qemu import wait_for_console_pattern
16
17class N8x0Machine(QemuSystemTest):
18    """Boots the Linux kernel and checks that the console is operational"""
19
20    timeout = 90
21
22    def __do_test_n8x0(self):
23        kernel_url = ('http://stskeeps.subnetmask.net/meego-n8x0/'
24                      'meego-arm-n8x0-1.0.80.20100712.1431-'
25                      'vmlinuz-2.6.35~rc4-129.1-n8x0')
26        kernel_hash = 'e9d5ab8d7548923a0061b6fbf601465e479ed269'
27        kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
28
29        self.vm.set_console(console_index=1)
30        self.vm.add_args('-kernel', kernel_path,
31                         '-append', 'printk.time=0 console=ttyS1')
32        self.vm.launch()
33        wait_for_console_pattern(self, 'TSC2005 driver initializing')
34
35    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
36    def test_n800(self):
37        """
38        :avocado: tags=arch:arm
39        :avocado: tags=machine:n800
40        """
41        self.__do_test_n8x0()
42
43    @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
44    def test_n810(self):
45        """
46        :avocado: tags=arch:arm
47        :avocado: tags=machine:n810
48        """
49        self.__do_test_n8x0()
50