1# Functional test that boots the canon-a1100 machine with firmware
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
11from avocado_qemu import QemuSystemTest
12from avocado_qemu import wait_for_console_pattern
13from avocado.utils import archive
14
15class CanonA1100Machine(QemuSystemTest):
16    """Boots the barebox firmware and checks that the console is operational"""
17
18    timeout = 90
19
20    def test_arm_canona1100(self):
21        """
22        :avocado: tags=arch:arm
23        :avocado: tags=machine:canon-a1100
24        :avocado: tags=device:pflash_cfi02
25        """
26        tar_url = ('https://www.qemu-advent-calendar.org'
27                   '/2018/download/day18.tar.xz')
28        tar_hash = '068b5fc4242b29381acee94713509f8a876e9db6'
29        file_path = self.fetch_asset(tar_url, asset_hash=tar_hash)
30        archive.extract(file_path, self.workdir)
31        self.vm.set_console()
32        self.vm.add_args('-bios',
33                         self.workdir + '/day18/barebox.canon-a1100.bin')
34        self.vm.launch()
35        wait_for_console_pattern(self, 'running /env/bin/init')
36