master
py 87 lines 3.08 KB
Raw
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
16 from qemu_test import Asset, LinuxKernelTest, wait_for_console_pattern
17
18
19 class 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://share.linaro.org/downloadFile?id=RRahAWwAwYKTZQd',
29 '00366fa51ea957c19462d2e2aefd480bef80ce727120e714ae48e0c88f261edb')
30
31 def launch_xen(self, xen_path):
32 """
33 Launch Xen with a dom0 guest kernel
34 """
35 self.require_accelerator("tcg") # virtualization=on
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://share.linaro.org/downloadFile?id=ALU4n2NGGYbE4fO',
58 'b745c2631342f9fcc0147ddc364edb62c20ecfebd430e5a3546e7d7c6891c0bc')
59
60 def test_arm64_xen_411_and_dom0(self):
61 # archive of file from https://deb.debian.org/debian/pool/main/x/xen/
62 xen_path = self.archive_extract(self.ASSET_XEN_4_11, format='deb',
63 member="boot/xen-4.11-arm64")
64 self.launch_xen(xen_path)
65
66 ASSET_XEN_4_14 = Asset(
67 'https://share.linaro.org/downloadFile?id=os4zSXPl7WW4lqX',
68 'e930a3293248edabd367d5b4b3b6448b9c99c057096ea8b47228a7870661d5cb')
69
70 def test_arm64_xen_414_and_dom0(self):
71 # archive of file from https://deb.debian.org/debian/pool/main/x/xen/
72 xen_path = self.archive_extract(self.ASSET_XEN_4_14, format='deb',
73 member="boot/xen-4.14-arm64")
74 self.launch_xen(xen_path)
75
76 ASSET_XEN_4_15 = Asset(
77 'https://share.linaro.org/downloadFile?id=jjjG4uTp2wuO4Ks',
78 '2a9a8af8acf0231844657cc28baab95bd918b0ee2d493ee4ee6f8846e1358bc9')
79
80 def test_arm64_xen_415_and_dom0(self):
81 xen_path = self.archive_extract(self.ASSET_XEN_4_15, format='deb',
82 member="boot/xen-4.15-unstable")
83 self.launch_xen(xen_path)
84
85
86 if __name__ == '__main__':
87 LinuxKernelTest.main()