qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: qemu-devel@nongnu.org
Cc: "Cleber Rosa" <crosa@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Paul Durrant" <paul@xen.org>
Subject: [PATCH 2/2] tests/avocado: Test Xen guest support under KVM
Date: Fri,  3 Mar 2023 12:51:26 +0000	[thread overview]
Message-ID: <20230303125126.1269861-3-dwmw2@infradead.org> (raw)
In-Reply-To: <20230303125126.1269861-1-dwmw2@infradead.org>

From: David Woodhouse <dwmw@amazon.co.uk>

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
 tests/avocado/xen_guest.py | 113 +++++++++++++++++++++++++++++++++++++
 1 file changed, 113 insertions(+)
 create mode 100644 tests/avocado/xen_guest.py

diff --git a/tests/avocado/xen_guest.py b/tests/avocado/xen_guest.py
new file mode 100644
index 0000000000..111ef3ca08
--- /dev/null
+++ b/tests/avocado/xen_guest.py
@@ -0,0 +1,113 @@
+# Xen guest functional tests
+#
+# Copyright © 2021 Red Hat, Inc.
+# Copyright © 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+#
+# Author:
+#  David Woodhouse <dwmw2@infradead.org>
+#
+# 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 import skipIf
+from avocado_qemu import LinuxTest
+
+@skipIf(os.getenv('GITLAB_CI'), 'Running on GitLab')
+class XenGuest(LinuxTest):
+    """
+    :avocado: tags=arch:x86_64
+    :avocado: tags=distro:fedora
+    :avocado: tags=distro_version:34
+    :avocado: tags=machine:q35
+    :avocado: tags=accel:kvm
+    :avocado: tags=xen_guest
+    """
+
+    kernel_path = None
+    initrd_path = None
+    kernel_params = None
+
+    def set_up_boot(self):
+        path = self.download_boot()
+        self.vm.add_args('-drive', 'file=%s,if=none,id=drv0' % path)
+        if False: # Soon...
+            self.vm.add_args('-device', 'xen-disk,drive=drv0,vdev=xvda')
+        else:
+            self.vm.add_args('-device', 'ahci,id=ahci')
+            self.vm.add_args('-device', 'ide-hd,drive=drv0,bus=ahci.0')
+
+    def setUp(self):
+        super(XenGuest, self).setUp(None, 'virtio-net-pci')
+
+    def common_vm_setup(self, custom_kernel=None):
+        self.require_accelerator("kvm")
+        self.vm.add_args("-accel", "kvm,xen-version=0x4000a,kernel-irqchip=split")
+
+        if custom_kernel is None:
+            return
+
+        kernel_url = self.distro.pxeboot_url + 'vmlinuz'
+        initrd_url = self.distro.pxeboot_url + 'initrd.img'
+        self.kernel_path = self.fetch_asset(kernel_url, algorithm='sha256',
+                                            asset_hash=self.distro.kernel_hash)
+        self.initrd_path = self.fetch_asset(initrd_url, algorithm='sha256',
+                                            asset_hash=self.distro.initrd_hash)
+
+    def run_and_check(self):
+        if self.kernel_path:
+            self.vm.add_args('-kernel', self.kernel_path,
+                             '-append', self.kernel_params,
+                             '-initrd', self.initrd_path)
+        self.launch_and_wait()
+        self.ssh_command('cat /proc/cmdline')
+        self.ssh_command('dmesg | grep -e "Grant table initialized"')
+
+    def test_xen_guest(self):
+        """
+        :avocado: tags=xen_guest
+        """
+
+        self.common_vm_setup(True)
+
+        self.kernel_params = (self.distro.default_kernel_params +
+                              ' xen_emul_unplug=ide-disks')
+        self.run_and_check()
+        self.ssh_command('grep xen-pirq.*msi /proc/interrupts')
+
+    def test_xen_guest_vapic(self):
+        """
+        :avocado: tags=xen_guest_vapic
+        """
+
+        self.common_vm_setup(True)
+        self.vm.add_args('-cpu', 'host,+xen-vapic')
+        self.kernel_params = (self.distro.default_kernel_params +
+                              ' xen_emul_unplug=ide-disks')
+        self.run_and_check()
+        self.ssh_command('grep xen-pirq /proc/interrupts')
+        self.ssh_command('grep PCI-MSI /proc/interrupts')
+
+    def test_xen_guest_novector(self):
+        """
+        :avocado: tags=xen_guest_novector
+        """
+
+        self.common_vm_setup(True)
+        self.kernel_params = (self.distro.default_kernel_params +
+                              ' xen_emul_unplug=ide-disks' +
+                              ' xen_no_vector_callback')
+        self.run_and_check()
+        self.ssh_command('grep xen-platform-pci /proc/interrupts')
+
+    def test_xen_guest_novector_noapic(self):
+        """
+        :avocado: tags=xen_guest_novector_noapic
+        """
+
+        self.common_vm_setup(True)
+        self.kernel_params = (self.distro.default_kernel_params +
+                              ' xen_emul_unplug=ide-disks' +
+                              ' xen_no_vector_callback noapic')
+        self.run_and_check()
+        self.ssh_command('grep xen-platform-pci /proc/interrupts')
-- 
2.39.0



      parent reply	other threads:[~2023-03-03 12:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-03 12:51 [PATCH 0/2] tests/avocado: Test Xen guest support under KVM David Woodhouse
2023-03-03 12:51 ` [PATCH 1/2] tests/avocado: Add Fedora 34 distro, including kernel/initrd checksums David Woodhouse
2023-03-03 12:51 ` David Woodhouse [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230303125126.1269861-3-dwmw2@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=crosa@redhat.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).