vmnet: stop recieving events when VM is stopped
[qemu/ar7.git] / tests / avocado / machine_aarch64_virt.py
blobc2b2ba2cf8724f9ab72fb349efceb6cf0340a6d8
1 # Functional test that boots a various Linux systems and checks the
2 # console output.
4 # Copyright (c) 2022 Linaro Ltd.
6 # Author:
7 # Alex Bennée <alex.bennee@linaro.org>
9 # SPDX-License-Identifier: GPL-2.0-or-later
11 import time
12 import os
14 from avocado_qemu import QemuSystemTest
15 from avocado_qemu import wait_for_console_pattern
16 from avocado_qemu import exec_command
17 from avocado_qemu import BUILD_DIR
19 class Aarch64VirtMachine(QemuSystemTest):
20 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
21 timeout = 360
23 def wait_for_console_pattern(self, success_message, vm=None):
24 wait_for_console_pattern(self, success_message,
25 failure_message='Kernel panic - not syncing',
26 vm=vm)
28 # This tests the whole boot chain from EFI to Userspace
29 # We only boot a whole OS for the current top level CPU and GIC
30 # Other test profiles should use more minimal boots
31 def test_alpine_virt_tcg_gic_max(self):
32 """
33 :avocado: tags=arch:aarch64
34 :avocado: tags=machine:virt
35 :avocado: tags=accel:tcg
36 """
37 iso_url = ('https://dl-cdn.alpinelinux.org/'
38 'alpine/v3.16/releases/aarch64/'
39 'alpine-virt-3.16.3-aarch64.iso')
41 # Alpine use sha256 so I recalculated this myself
42 iso_sha1 = '0683bc089486d55c91bf6607d5ecb93925769bc0'
43 iso_path = self.fetch_asset(iso_url, asset_hash=iso_sha1)
45 self.vm.set_console()
46 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
47 'console=ttyAMA0')
48 self.require_accelerator("tcg")
50 self.vm.add_args("-accel", "tcg")
51 self.vm.add_args("-cpu", "max,pauth-impdef=on")
52 self.vm.add_args("-machine",
53 "virt,acpi=on,"
54 "virtualization=on,"
55 "mte=on,"
56 "gic-version=max,iommu=smmuv3")
57 self.vm.add_args("-smp", "2", "-m", "1024")
58 self.vm.add_args('-bios', os.path.join(BUILD_DIR, 'pc-bios',
59 'edk2-aarch64-code.fd'))
60 self.vm.add_args("-drive", f"file={iso_path},format=raw")
61 self.vm.add_args('-device', 'virtio-rng-pci,rng=rng0')
62 self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom')
64 self.vm.launch()
65 self.wait_for_console_pattern('Welcome to Alpine Linux 3.16')
68 def test_aarch64_virt(self):
69 """
70 :avocado: tags=arch:aarch64
71 :avocado: tags=machine:virt
72 :avocado: tags=accel:tcg
73 :avocado: tags=cpu:max
74 """
75 kernel_url = ('https://fileserver.linaro.org/s/'
76 'z6B2ARM7DQT3HWN/download')
78 kernel_hash = 'ed11daab50c151dde0e1e9c9cb8b2d9bd3215347'
79 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
81 self.vm.set_console()
82 kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
83 'console=ttyAMA0')
84 self.require_accelerator("tcg")
85 self.vm.add_args('-cpu', 'max,pauth-impdef=on',
86 '-accel', 'tcg',
87 '-kernel', kernel_path,
88 '-append', kernel_command_line)
89 self.vm.launch()
90 self.wait_for_console_pattern('Welcome to Buildroot')
91 time.sleep(0.1)
92 exec_command(self, 'root')
93 time.sleep(0.1)
94 exec_command(self, 'cat /proc/self/maps')
95 time.sleep(0.1)