xref: /qemu/tests/avocado/machine_aspeed.py (revision 2a3129a3)
1# Functional test that boots the ASPEED SoCs with firmware
2#
3# Copyright (C) 2022 ASPEED Technology Inc
4#
5# This work is licensed under the terms of the GNU GPL, version 2 or
6# later.  See the COPYING file in the top-level directory.
7
8from avocado_qemu import QemuSystemTest
9from avocado_qemu import wait_for_console_pattern
10from avocado_qemu import exec_command_and_wait_for_pattern
11from avocado.utils import archive
12
13
14class AST1030Machine(QemuSystemTest):
15    """Boots the zephyr os and checks that the console is operational"""
16
17    timeout = 10
18
19    def test_ast1030_zephyros(self):
20        """
21        :avocado: tags=arch:arm
22        :avocado: tags=machine:ast1030-evb
23        """
24        tar_url = ('https://github.com/AspeedTech-BMC'
25                   '/zephyr/releases/download/v00.01.04/ast1030-evb-demo.zip')
26        tar_hash = '4c6a8ce3a8ba76ef1a65dae419ae3409343c4b20'
27        tar_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
28        archive.extract(tar_path, self.workdir)
29        kernel_file = self.workdir + "/ast1030-evb-demo/zephyr.elf"
30        self.vm.set_console()
31        self.vm.add_args('-kernel', kernel_file,
32                         '-nographic')
33        self.vm.launch()
34        wait_for_console_pattern(self, "Booting Zephyr OS")
35        exec_command_and_wait_for_pattern(self, "help",
36                                          "Available commands")
37