mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-31 14:02:05 -06:00
tests/functional: Convert the kvm_xen_guest avocado test
Use the serial console to execute the commands in the guest instead of using ssh since we don't have ssh support in the functional framework yet. Acked-by: David Woodhouse <dwmw@amazon.co.uk> Message-ID: <20250113082516.57894-1-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
d6430c17d7
commit
0a8b4fd59f
3 changed files with 55 additions and 38 deletions
|
@ -489,7 +489,7 @@ S: Supported
|
||||||
F: include/system/kvm_xen.h
|
F: include/system/kvm_xen.h
|
||||||
F: target/i386/kvm/xen*
|
F: target/i386/kvm/xen*
|
||||||
F: hw/i386/kvm/xen*
|
F: hw/i386/kvm/xen*
|
||||||
F: tests/avocado/kvm_xen_guest.py
|
F: tests/functional/test_x86_64_kvm_xen.py
|
||||||
|
|
||||||
Guest CPU Cores (other accelerators)
|
Guest CPU Cores (other accelerators)
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|
|
@ -44,6 +44,7 @@ test_timeouts = {
|
||||||
'riscv64_tuxrun' : 120,
|
'riscv64_tuxrun' : 120,
|
||||||
's390x_ccw_virtio' : 420,
|
's390x_ccw_virtio' : 420,
|
||||||
'sh4_tuxrun' : 240,
|
'sh4_tuxrun' : 240,
|
||||||
|
'x86_64_kvm_xen' : 180,
|
||||||
}
|
}
|
||||||
|
|
||||||
tests_generic_system = [
|
tests_generic_system = [
|
||||||
|
@ -244,6 +245,7 @@ tests_x86_64_system_thorough = [
|
||||||
'netdev_ethtool',
|
'netdev_ethtool',
|
||||||
'virtio_gpu',
|
'virtio_gpu',
|
||||||
'x86_64_hotplug_cpu',
|
'x86_64_hotplug_cpu',
|
||||||
|
'x86_64_kvm_xen',
|
||||||
'x86_64_tuxrun',
|
'x86_64_tuxrun',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
89
tests/avocado/kvm_xen_guest.py → tests/functional/test_x86_64_kvm_xen.py
Normal file → Executable file
89
tests/avocado/kvm_xen_guest.py → tests/functional/test_x86_64_kvm_xen.py
Normal file → Executable file
|
@ -1,3 +1,5 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
# KVM Xen guest functional tests
|
# KVM Xen guest functional tests
|
||||||
#
|
#
|
||||||
# Copyright © 2021 Red Hat, Inc.
|
# Copyright © 2021 Red Hat, Inc.
|
||||||
|
@ -13,19 +15,12 @@ import os
|
||||||
|
|
||||||
from qemu.machine import machine
|
from qemu.machine import machine
|
||||||
|
|
||||||
from avocado_qemu import LinuxSSHMixIn
|
from qemu_test import QemuSystemTest, Asset, exec_command_and_wait_for_pattern
|
||||||
from avocado_qemu import QemuSystemTest
|
from qemu_test import wait_for_console_pattern
|
||||||
from avocado_qemu import wait_for_console_pattern
|
|
||||||
|
|
||||||
class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
class KVMXenGuest(QemuSystemTest):
|
||||||
"""
|
|
||||||
:avocado: tags=arch:x86_64
|
|
||||||
:avocado: tags=machine:q35
|
|
||||||
:avocado: tags=accel:kvm
|
|
||||||
:avocado: tags=kvm_xen_guest
|
|
||||||
"""
|
|
||||||
|
|
||||||
KERNEL_DEFAULT = 'printk.time=0 root=/dev/xvda console=ttyS0'
|
KERNEL_DEFAULT = 'printk.time=0 root=/dev/xvda console=ttyS0 quiet'
|
||||||
|
|
||||||
kernel_path = None
|
kernel_path = None
|
||||||
kernel_params = None
|
kernel_params = None
|
||||||
|
@ -33,14 +28,15 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
# Fetch assets from the kvm-xen-guest subdir of my shared test
|
# Fetch assets from the kvm-xen-guest subdir of my shared test
|
||||||
# images directory on fileserver.linaro.org where you can find
|
# images directory on fileserver.linaro.org where you can find
|
||||||
# build instructions for how they where assembled.
|
# build instructions for how they where assembled.
|
||||||
def get_asset(self, name, sha1):
|
ASSET_KERNEL = Asset(
|
||||||
base_url = ('https://fileserver.linaro.org/s/'
|
('https://fileserver.linaro.org/s/kE4nCFLdQcoBF9t/download?'
|
||||||
'kE4nCFLdQcoBF9t/download?'
|
'path=%2Fkvm-xen-guest&files=bzImage'),
|
||||||
'path=%2Fkvm-xen-guest&files=' )
|
'ec0ad7bb8c33c5982baee0a75505fe7dbf29d3ff5d44258204d6307c6fe0132a')
|
||||||
url = base_url + name
|
|
||||||
# use explicit name rather than failing to neatly parse the
|
ASSET_ROOTFS = Asset(
|
||||||
# URL into a unique one
|
('https://fileserver.linaro.org/s/kE4nCFLdQcoBF9t/download?'
|
||||||
return self.fetch_asset(name=name, locations=(url), asset_hash=sha1)
|
'path=%2Fkvm-xen-guest&files=rootfs.ext4'),
|
||||||
|
'b11045d649006c649c184e93339aaa41a8fe20a1a86620af70323252eb29e40b')
|
||||||
|
|
||||||
def common_vm_setup(self):
|
def common_vm_setup(self):
|
||||||
# We also catch lack of KVM_XEN support if we fail to launch
|
# We also catch lack of KVM_XEN support if we fail to launch
|
||||||
|
@ -51,10 +47,8 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
self.vm.add_args("-accel", "kvm,xen-version=0x4000a,kernel-irqchip=split")
|
self.vm.add_args("-accel", "kvm,xen-version=0x4000a,kernel-irqchip=split")
|
||||||
self.vm.add_args("-smp", "2")
|
self.vm.add_args("-smp", "2")
|
||||||
|
|
||||||
self.kernel_path = self.get_asset("bzImage",
|
self.kernel_path = self.ASSET_KERNEL.fetch()
|
||||||
"367962983d0d32109998a70b45dcee4672d0b045")
|
self.rootfs = self.ASSET_ROOTFS.fetch()
|
||||||
self.rootfs = self.get_asset("rootfs.ext4",
|
|
||||||
"f1478401ea4b3fa2ea196396be44315bab2bb5e4")
|
|
||||||
|
|
||||||
def run_and_check(self):
|
def run_and_check(self):
|
||||||
self.vm.add_args('-kernel', self.kernel_path,
|
self.vm.add_args('-kernel', self.kernel_path,
|
||||||
|
@ -68,10 +62,10 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
self.vm.launch()
|
self.vm.launch()
|
||||||
except machine.VMLaunchFailure as e:
|
except machine.VMLaunchFailure as e:
|
||||||
if "Xen HVM guest support not present" in e.output:
|
if "Xen HVM guest support not present" in e.output:
|
||||||
self.cancel("KVM Xen support is not present "
|
self.skipTest("KVM Xen support is not present "
|
||||||
"(need v5.12+ kernel with CONFIG_KVM_XEN)")
|
"(need v5.12+ kernel with CONFIG_KVM_XEN)")
|
||||||
elif "Property 'kvm-accel.xen-version' not found" in e.output:
|
elif "Property 'kvm-accel.xen-version' not found" in e.output:
|
||||||
self.cancel("QEMU not built with CONFIG_XEN_EMU support")
|
self.skipTest("QEMU not built with CONFIG_XEN_EMU support")
|
||||||
else:
|
else:
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
@ -79,10 +73,11 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
console_pattern = 'Starting dropbear sshd: OK'
|
console_pattern = 'Starting dropbear sshd: OK'
|
||||||
wait_for_console_pattern(self, console_pattern, 'Oops')
|
wait_for_console_pattern(self, console_pattern, 'Oops')
|
||||||
self.log.info('sshd ready')
|
self.log.info('sshd ready')
|
||||||
self.ssh_connect('root', '', False)
|
|
||||||
|
|
||||||
self.ssh_command('cat /proc/cmdline')
|
exec_command_and_wait_for_pattern(self, 'cat /proc/cmdline', 'xen')
|
||||||
self.ssh_command('dmesg | grep -e "Grant table initialized"')
|
exec_command_and_wait_for_pattern(self, 'dmesg | grep "Grant table"',
|
||||||
|
'Grant table initialized')
|
||||||
|
wait_for_console_pattern(self, '#', 'Oops')
|
||||||
|
|
||||||
def test_kvm_xen_guest(self):
|
def test_kvm_xen_guest(self):
|
||||||
"""
|
"""
|
||||||
|
@ -94,7 +89,9 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
self.kernel_params = (self.KERNEL_DEFAULT +
|
self.kernel_params = (self.KERNEL_DEFAULT +
|
||||||
' xen_emul_unplug=ide-disks')
|
' xen_emul_unplug=ide-disks')
|
||||||
self.run_and_check()
|
self.run_and_check()
|
||||||
self.ssh_command('grep xen-pirq.*msi /proc/interrupts')
|
exec_command_and_wait_for_pattern(self,
|
||||||
|
'grep xen-pirq.*msi /proc/interrupts',
|
||||||
|
'virtio0-output')
|
||||||
|
|
||||||
def test_kvm_xen_guest_nomsi(self):
|
def test_kvm_xen_guest_nomsi(self):
|
||||||
"""
|
"""
|
||||||
|
@ -106,7 +103,9 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
self.kernel_params = (self.KERNEL_DEFAULT +
|
self.kernel_params = (self.KERNEL_DEFAULT +
|
||||||
' xen_emul_unplug=ide-disks pci=nomsi')
|
' xen_emul_unplug=ide-disks pci=nomsi')
|
||||||
self.run_and_check()
|
self.run_and_check()
|
||||||
self.ssh_command('grep xen-pirq.* /proc/interrupts')
|
exec_command_and_wait_for_pattern(self,
|
||||||
|
'grep xen-pirq.* /proc/interrupts',
|
||||||
|
'virtio0')
|
||||||
|
|
||||||
def test_kvm_xen_guest_noapic_nomsi(self):
|
def test_kvm_xen_guest_noapic_nomsi(self):
|
||||||
"""
|
"""
|
||||||
|
@ -118,7 +117,9 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
self.kernel_params = (self.KERNEL_DEFAULT +
|
self.kernel_params = (self.KERNEL_DEFAULT +
|
||||||
' xen_emul_unplug=ide-disks noapic pci=nomsi')
|
' xen_emul_unplug=ide-disks noapic pci=nomsi')
|
||||||
self.run_and_check()
|
self.run_and_check()
|
||||||
self.ssh_command('grep xen-pirq /proc/interrupts')
|
exec_command_and_wait_for_pattern(self,
|
||||||
|
'grep xen-pirq /proc/interrupts',
|
||||||
|
'virtio0')
|
||||||
|
|
||||||
def test_kvm_xen_guest_vapic(self):
|
def test_kvm_xen_guest_vapic(self):
|
||||||
"""
|
"""
|
||||||
|
@ -130,8 +131,13 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
self.kernel_params = (self.KERNEL_DEFAULT +
|
self.kernel_params = (self.KERNEL_DEFAULT +
|
||||||
' xen_emul_unplug=ide-disks')
|
' xen_emul_unplug=ide-disks')
|
||||||
self.run_and_check()
|
self.run_and_check()
|
||||||
self.ssh_command('grep xen-pirq /proc/interrupts')
|
exec_command_and_wait_for_pattern(self,
|
||||||
self.ssh_command('grep PCI-MSI /proc/interrupts')
|
'grep xen-pirq /proc/interrupts',
|
||||||
|
'acpi')
|
||||||
|
wait_for_console_pattern(self, '#')
|
||||||
|
exec_command_and_wait_for_pattern(self,
|
||||||
|
'grep PCI-MSI /proc/interrupts',
|
||||||
|
'virtio0-output')
|
||||||
|
|
||||||
def test_kvm_xen_guest_novector(self):
|
def test_kvm_xen_guest_novector(self):
|
||||||
"""
|
"""
|
||||||
|
@ -143,7 +149,9 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
' xen_emul_unplug=ide-disks' +
|
' xen_emul_unplug=ide-disks' +
|
||||||
' xen_no_vector_callback')
|
' xen_no_vector_callback')
|
||||||
self.run_and_check()
|
self.run_and_check()
|
||||||
self.ssh_command('grep xen-platform-pci /proc/interrupts')
|
exec_command_and_wait_for_pattern(self,
|
||||||
|
'grep xen-platform-pci /proc/interrupts',
|
||||||
|
'fasteoi')
|
||||||
|
|
||||||
def test_kvm_xen_guest_novector_nomsi(self):
|
def test_kvm_xen_guest_novector_nomsi(self):
|
||||||
"""
|
"""
|
||||||
|
@ -156,7 +164,9 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
' xen_emul_unplug=ide-disks pci=nomsi' +
|
' xen_emul_unplug=ide-disks pci=nomsi' +
|
||||||
' xen_no_vector_callback')
|
' xen_no_vector_callback')
|
||||||
self.run_and_check()
|
self.run_and_check()
|
||||||
self.ssh_command('grep xen-platform-pci /proc/interrupts')
|
exec_command_and_wait_for_pattern(self,
|
||||||
|
'grep xen-platform-pci /proc/interrupts',
|
||||||
|
'IO-APIC')
|
||||||
|
|
||||||
def test_kvm_xen_guest_novector_noapic(self):
|
def test_kvm_xen_guest_novector_noapic(self):
|
||||||
"""
|
"""
|
||||||
|
@ -168,4 +178,9 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn):
|
||||||
' xen_emul_unplug=ide-disks' +
|
' xen_emul_unplug=ide-disks' +
|
||||||
' xen_no_vector_callback noapic')
|
' xen_no_vector_callback noapic')
|
||||||
self.run_and_check()
|
self.run_and_check()
|
||||||
self.ssh_command('grep xen-platform-pci /proc/interrupts')
|
exec_command_and_wait_for_pattern(self,
|
||||||
|
'grep xen-platform-pci /proc/interrupts',
|
||||||
|
'XT-PIC')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
QemuSystemTest.main()
|
Loading…
Add table
Add a link
Reference in a new issue