1#!/usr/bin/env python3 2# 3# Functional test that boots a Xen hypervisor with a domU kernel and 4# checks the console output is vaguely sane . 5# 6# Copyright (c) 2020 Linaro 7# 8# Author: 9# Alex Bennée <alex.bennee@linaro.org> 10# 11# SPDX-License-Identifier: GPL-2.0-or-later 12# 13# This work is licensed under the terms of the GNU GPL, version 2 or 14# later. See the COPYING file in the top-level directory. 15 16from qemu_test import Asset, LinuxKernelTest, wait_for_console_pattern 17 18 19class BootXen(LinuxKernelTest): 20 """ 21 Boots a Xen hypervisor with a Linux DomU kernel. 22 """ 23 24 timeout = 90 25 XEN_COMMON_COMMAND_LINE = 'dom0_mem=128M loglvl=all guest_loglvl=all' 26 27 ASSET_KERNEL = Asset( 28 ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/' 29 'download?path=%2F&files=linux-5.9.9-arm64-ajb'), 30 '00366fa51ea957c19462d2e2aefd480bef80ce727120e714ae48e0c88f261edb') 31 32 def launch_xen(self, xen_path): 33 """ 34 Launch Xen with a dom0 guest kernel 35 """ 36 self.set_machine('virt') 37 self.cpu = "cortex-a57" 38 self.kernel_path = self.ASSET_KERNEL.fetch() 39 self.log.info("launch with xen_path: %s", xen_path) 40 41 self.vm.set_console() 42 43 self.vm.add_args('-machine', 'virtualization=on', 44 '-m', '768', 45 '-kernel', xen_path, 46 '-append', self.XEN_COMMON_COMMAND_LINE, 47 '-device', 48 'guest-loader,addr=0x47000000,kernel=%s,bootargs=console=hvc0' 49 % (self.kernel_path)) 50 51 self.vm.launch() 52 53 console_pattern = 'VFS: Cannot open root device' 54 wait_for_console_pattern(self, console_pattern, "Panic on CPU 0:") 55 56 ASSET_XEN_4_11 = Asset( 57 ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/download?path=%2F&' 58 'files=xen-hypervisor-4.11-arm64_4.11.4%2B37-g3263f257ca-1_arm64.deb'), 59 'b745c2631342f9fcc0147ddc364edb62c20ecfebd430e5a3546e7d7c6891c0bc') 60 61 def test_arm64_xen_411_and_dom0(self): 62 # archive of file from https://deb.debian.org/debian/pool/main/x/xen/ 63 xen_path = self.archive_extract(self.ASSET_XEN_4_11, format='deb', 64 member="boot/xen-4.11-arm64") 65 self.launch_xen(xen_path) 66 67 ASSET_XEN_4_14 = Asset( 68 ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/download?path=%2F&' 69 'files=xen-hypervisor-4.14-arm64_4.14.0%2B80-gd101b417b7-1_arm64.deb'), 70 'e930a3293248edabd367d5b4b3b6448b9c99c057096ea8b47228a7870661d5cb') 71 72 def test_arm64_xen_414_and_dom0(self): 73 # archive of file from https://deb.debian.org/debian/pool/main/x/xen/ 74 xen_path = self.archive_extract(self.ASSET_XEN_4_14, format='deb', 75 member="boot/xen-4.14-arm64") 76 self.launch_xen(xen_path) 77 78 ASSET_XEN_4_15 = Asset( 79 ('https://fileserver.linaro.org/s/JSsewXGZ6mqxPr5/download?path=%2F&' 80 'files=xen-upstream-4.15-unstable.deb'), 81 '2a9a8af8acf0231844657cc28baab95bd918b0ee2d493ee4ee6f8846e1358bc9') 82 83 def test_arm64_xen_415_and_dom0(self): 84 xen_path = self.archive_extract(self.ASSET_XEN_4_15, format='deb', 85 member="boot/xen-4.15-unstable") 86 self.launch_xen(xen_path) 87 88 89if __name__ == '__main__': 90 LinuxKernelTest.main() 91