Merge remote-tracking branch 'qemu-project/master'
[qemu/ar7.git] / tests / avocado / boot_xen.py
blobfc2faeedb559d8e39722e08d2c8257baebd661c6
1 # Functional test that boots a Xen hypervisor with a domU kernel and
2 # checks the console output is vaguely sane .
4 # Copyright (c) 2020 Linaro
6 # Author:
7 # Alex Bennée <alex.bennee@linaro.org>
9 # SPDX-License-Identifier: GPL-2.0-or-later
11 # This work is licensed under the terms of the GNU GPL, version 2 or
12 # later. See the COPYING file in the top-level directory.
14 import os
16 from avocado_qemu import wait_for_console_pattern
17 from boot_linux_console import LinuxKernelTest
20 class BootXenBase(LinuxKernelTest):
21 """
22 Boots a Xen hypervisor with a Linux DomU kernel.
23 """
25 timeout = 90
26 XEN_COMMON_COMMAND_LINE = 'dom0_mem=128M loglvl=all guest_loglvl=all'
28 def fetch_guest_kernel(self):
29 # Using my own built kernel - which works
30 kernel_url = ('https://fileserver.linaro.org/'
31 's/JSsewXGZ6mqxPr5/download?path=%2F&files='
32 'linux-5.9.9-arm64-ajb')
33 kernel_sha1 = '4f92bc4b9f88d5ab792fa7a43a68555d344e1b83'
34 kernel_path = self.fetch_asset(kernel_url,
35 asset_hash=kernel_sha1)
37 return kernel_path
39 def launch_xen(self, xen_path):
40 """
41 Launch Xen with a dom0 guest kernel
42 """
43 self.log.info("launch with xen_path: %s", xen_path)
44 kernel_path = self.fetch_guest_kernel()
46 self.vm.set_console()
48 xen_command_line = self.XEN_COMMON_COMMAND_LINE
49 self.vm.add_args('-machine', 'virtualization=on',
50 '-m', '768',
51 '-kernel', xen_path,
52 '-append', xen_command_line,
53 '-device',
54 'guest-loader,addr=0x47000000,kernel=%s,bootargs=console=hvc0'
55 % (kernel_path))
57 self.vm.launch()
59 console_pattern = 'VFS: Cannot open root device'
60 wait_for_console_pattern(self, console_pattern, "Panic on CPU 0:")
63 class BootXen(BootXenBase):
65 def test_arm64_xen_411_and_dom0(self):
66 """
67 :avocado: tags=arch:aarch64
68 :avocado: tags=accel:tcg
69 :avocado: tags=cpu:cortex-a57
70 :avocado: tags=machine:virt
71 """
73 # archive of file from https://deb.debian.org/debian/pool/main/x/xen/
74 xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/'
75 'download?path=%2F&files='
76 'xen-hypervisor-4.11-arm64_4.11.4%2B37-g3263f257ca-1_arm64.deb')
77 xen_sha1 = '034e634d4416adbad1212d59b62bccdcda63e62a'
78 xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
79 xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.11-arm64")
81 self.launch_xen(xen_path)
83 def test_arm64_xen_414_and_dom0(self):
84 """
85 :avocado: tags=arch:aarch64
86 :avocado: tags=accel:tcg
87 :avocado: tags=cpu:cortex-a57
88 :avocado: tags=machine:virt
89 """
91 # archive of file from https://deb.debian.org/debian/pool/main/x/xen/
92 xen_url = ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/'
93 'download?path=%2F&files='
94 'xen-hypervisor-4.14-arm64_4.14.0%2B80-gd101b417b7-1_arm64.deb')
95 xen_sha1 = 'b9d209dd689ed2b393e625303a225badefec1160'
96 xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
97 xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.14-arm64")
99 self.launch_xen(xen_path)
101 def test_arm64_xen_415_and_dom0(self):
103 :avocado: tags=arch:aarch64
104 :avocado: tags=accel:tcg
105 :avocado: tags=cpu:cortex-a57
106 :avocado: tags=machine:virt
109 xen_url = ('https://fileserver.linaro.org/'
110 's/JSsewXGZ6mqxPr5/download'
111 '?path=%2F&files=xen-upstream-4.15-unstable.deb')
112 xen_sha1 = 'fc191172b85cf355abb95d275a24cc0f6d6579d8'
113 xen_deb = self.fetch_asset(xen_url, asset_hash=xen_sha1)
114 xen_path = self.extract_from_deb(xen_deb, "/boot/xen-4.15-unstable")
116 self.launch_xen(xen_path)