qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: qemu-devel@nongnu.org
Cc: fam@euphon.net, alex.bennee@linaro.org, wrampazz@redhat.com,
	crosa@redhat.com, philmd@redhat.com, sgarzare@redhat.com
Subject: [PATCH 1/2] tests/acceptance: Add PVH boot test
Date: Fri,  6 Dec 2019 09:00:11 -0500	[thread overview]
Message-ID: <20191206140012.15517-2-wainersm@redhat.com> (raw)
In-Reply-To: <20191206140012.15517-1-wainersm@redhat.com>

QEMU 4.0 onward is able to boot an uncompressed kernel
image by using the x86/HVM direct boot ABI. It needs
Linux >= 4.21 built with CONFIG_PVH=y.

This introduces an acceptance test which checks an
uncompressed Linux kernel image boots properly.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 tests/acceptance/pvh.py | 48 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 tests/acceptance/pvh.py

diff --git a/tests/acceptance/pvh.py b/tests/acceptance/pvh.py
new file mode 100644
index 0000000000..c68489c273
--- /dev/null
+++ b/tests/acceptance/pvh.py
@@ -0,0 +1,48 @@
+# Copyright (c) 2019 Red Hat, Inc.
+#
+# Author:
+#  Wainer dos Santos Moschetta <wainersm@redhat.com>
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or
+# later.  See the COPYING file in the top-level directory.
+
+"""
+x86/HVM direct boot acceptance tests.
+"""
+
+from avocado.utils.kernel import KernelBuild
+from avocado_qemu import Test
+from avocado_qemu import wait_for_console_pattern
+
+
+class Pvh(Test):
+    """
+    Test suite for x86/HVM direct boot feature.
+
+    :avocado: tags=slow,arch=x86_64,machine=q35
+    """
+    def test_boot_vmlinux(self):
+        """
+        Boot uncompressed kernel image.
+        """
+        # QEMU can boot a vmlinux image for kernel >= 4.21 built
+        # with CONFIG_PVH=y
+        kernel_version = '5.4.1'
+        kbuild = KernelBuild(kernel_version, work_dir=self.workdir)
+        try:
+            kbuild.download()
+            kbuild.uncompress()
+            kbuild.configure(targets=['defconfig', 'kvmconfig'],
+                             extra_configs=['CONFIG_PVH=y'])
+            kbuild.build()
+        except:
+            self.cancel("Unable to build vanilla kernel %s" % kernel_version)
+
+        self.vm.set_machine('q35')
+        self.vm.set_console()
+        kernel_command_line = 'printk.time=0 console=ttyS0'
+        self.vm.add_args('-kernel', kbuild.vmlinux,
+                         '-append', kernel_command_line)
+        self.vm.launch()
+        wait_for_console_pattern(self, 'Kernel command line: %s' %
+                                 kernel_command_line)
-- 
2.21.0



  reply	other threads:[~2019-12-06 14:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-06 14:00 [PATCH 0/2] tests/acceptance: Add boot vmlinux test Wainer dos Santos Moschetta
2019-12-06 14:00 ` Wainer dos Santos Moschetta [this message]
2019-12-06 15:04   ` [PATCH 1/2] tests/acceptance: Add PVH boot test Willian Rampazzo
2019-12-06 16:54   ` Cleber Rosa
2019-12-09 14:43     ` Wainer dos Santos Moschetta
2019-12-10  2:21       ` Cleber Rosa
2019-12-10 11:16   ` Philippe Mathieu-Daudé
2019-12-06 14:00 ` [PATCH 2/2] .travis.yml: Add kernel build deps for acceptance tests Wainer dos Santos Moschetta
2019-12-12 12:22   ` Alex Bennée
2019-12-06 16:42 ` [PATCH 0/2] tests/acceptance: Add boot vmlinux test Cleber Rosa
2019-12-10 11:05   ` Alex Bennée

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=20191206140012.15517-2-wainersm@redhat.com \
    --to=wainersm@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=crosa@redhat.com \
    --cc=fam@euphon.net \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=wrampazz@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).