qemu/tests/avocado/boot_xen.py
Cleber Rosa 8dceb48e23 tests/avocado/boot_xen.py: fetch kernel during test setUp()
The kernel is a common blob used in all tests.  By moving it to the
setUp() method, the "fetch asset" plugin will recognize the kernel and
attempt to fetch it and cache it before the tests are started.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-ID: <20240806173119.582857-7-crosa@redhat.com>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Tested-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
Message-ID: <20240830133841.142644-3-thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-09-04 10:51:27 +02:00

96 lines
3.5 KiB
Python

# Functional test that boots a Xen hypervisor with a domU kernel and
# checks the console output is vaguely sane .
#
# Copyright (c) 2020 Linaro
#
# Author:
# Alex Bennée <alex.bennee@linaro.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# This work is licensed under the terms of the GNU GPL, version 2 or
# later. See the COPYING file in the top-level directory.
import os
from avocado_qemu import wait_for_console_pattern
from boot_linux_console import LinuxKernelTest
class BootXen(LinuxKernelTest):
"""
Boots a Xen hypervisor with a Linux DomU kernel.
:avocado: tags=arch:aarch64
:avocado: tags=accel:tcg
:avocado: tags=cpu:cortex-a57
:avocado: tags=machine:virt
"""
timeout = 90
XEN_COMMON_COMMAND_LINE = 'dom0_mem=128M loglvl=all guest_loglvl=all'
def setUp(self):
super(BootXen, self).setUp()
# Using my own built kernel - which works
kernel_url = ('https://fileserver.linaro.org/'
's/JSsewXGZ6mqxPr5/download?path=%2F&files='
'linux-5.9.9-arm64-ajb')
kernel_sha1 = '4f92bc4b9f88d5ab792fa7a43a68555d344e1b83'
self.kernel_path = self.fetch_asset(kernel_url,
asset_hash=kernel_sha1)
def launch_xen(self, xen_path):
"""
Launch Xen with a dom0 guest kernel
"""
self.log.info("launch with xen_path: %s", xen_path)
self.vm.set_console()
self.vm.add_args('-machine', 'virtualization=on',
'-m', '768',
'-kernel', xen_path,
'-append', self.XEN_COMMON_COMMAND_LINE,
'-device',
'guest-loader,addr=0x47000000,kernel=%s,bootargs=console=hvc0'
% (self.kernel_path))
self.vm.launch()
console_pattern = 'VFS: Cannot open root device'
wait_for_console_pattern(self, console_pattern, "Panic on CPU 0:")
def test_arm64_xen_411_and_dom0(self):
# archive of file from https://deb.debian.org/debian/pool/main/x/xen/
xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/'
'download?path=%2F&files='
'xen-hypervisor-4.11-arm64_4.11.4%2B37-g3263f257ca-1_arm64.deb')
xen_sha1 = '034e634d4416adbad1212d59b62bccdcda63e62a'
xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.11-arm64")
self.launch_xen(xen_path)
def test_arm64_xen_414_and_dom0(self):
# archive of file from https://deb.debian.org/debian/pool/main/x/xen/
xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/'
'download?path=%2F&files='
'xen-hypervisor-4.14-arm64_4.14.0%2B80-gd101b417b7-1_arm64.deb')
xen_sha1 = 'b9d209dd689ed2b393e625303a225badefec1160'
xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.14-arm64")
self.launch_xen(xen_path)
def test_arm64_xen_415_and_dom0(self):
xen_url = ('https://fileserver.linaro.org/'
's/JSsewXGZ6mqxPr5/download'
'?path=%2F&files=xen-upstream-4.15-unstable.deb')
xen_sha1 = 'fc191172b85cf355abb95d275a24cc0f6d6579d8'
xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.15-unstable")
self.launch_xen(xen_path)