From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: qemu-devel@nongnu.org
Cc: philmd@redhat.com, jsnow@redhat.com, ehabkost@redhat.com,
crosa@redhat.com
Subject: [Qemu-devel] [PATCH 3/3] tests/acceptance: Add boot linux with kvm test
Date: Fri, 28 Jun 2019 11:02:17 -0400 [thread overview]
Message-ID: <20190628150217.32659-4-wainersm@redhat.com> (raw)
In-Reply-To: <20190628150217.32659-1-wainersm@redhat.com>
Until now the suite of acceptance tests doesn't exercise
QEMU with kvm enabled. So this introduces a simple test
that boots the Linux kernel and checks it boots on the
accelerator correctly.
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
tests/acceptance/kvm.py | 58 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 tests/acceptance/kvm.py
diff --git a/tests/acceptance/kvm.py b/tests/acceptance/kvm.py
new file mode 100644
index 0000000000..aafb865cdb
--- /dev/null
+++ b/tests/acceptance/kvm.py
@@ -0,0 +1,58 @@
+# KVM acceptance tests.
+#
+# 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.
+
+import logging
+
+from avocado_qemu import Test
+
+
+class Kvm(Test):
+ """
+ Suite of acceptance tests to check QEMU and KVM integration.
+ """
+
+ def test_boot_linux(self):
+ """
+ Simple Linux boot test with kvm enabled.
+
+ :avocado: tags=arch:x86_64
+ :avocado: tags=accel:kvm
+ """
+ self.vm.add_args('-enable-kvm')
+ kernel_url = ('https://download.fedoraproject.org/pub/fedora/linux/'
+ 'releases/29/Everything/x86_64/os/images/pxeboot/vmlinuz')
+ kernel_hash = '23bebd2680757891cf7adedb033532163a792495'
+ kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
+
+ self.vm.set_machine('pc')
+ self.vm.set_console()
+ self.vm.add_args('-kernel', kernel_path,
+ '-append', 'printk.time=0 console=ttyS0')
+ self.vm.launch()
+
+ query = self.vm.command('query-kvm')
+ self.assertTrue(query['enabled'])
+ self.assertTrue(query['present'])
+
+ console = self.vm.console_socket.makefile()
+ console_logger = logging.getLogger('console')
+ failure_message = 'Kernel panic - not syncing'
+ success_message = 'Booting paravirtualized kernel on KVM'
+
+ while True:
+ msg = console.readline().strip()
+ if not msg:
+ continue
+ console_logger.debug(msg)
+ if success_message in msg:
+ break
+ if failure_message in msg:
+ fail = 'Failure message found in console: %s' % failure_message
+ self.fail(fail)
--
2.21.0
next prev parent reply other threads:[~2019-06-28 15:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 15:02 [Qemu-devel] [PATCH 0/3] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
2019-06-28 15:02 ` [Qemu-devel] [PATCH 1/3] python/qemu: Allow to launch the VM without qmp Wainer dos Santos Moschetta
2019-06-28 15:02 ` [Qemu-devel] [PATCH 2/3] tests/acceptance: Introduce the "accel" tag Wainer dos Santos Moschetta
2019-06-28 15:02 ` Wainer dos Santos Moschetta [this message]
2019-06-28 20:18 ` [Qemu-devel] [PATCH 3/3] tests/acceptance: Add boot linux with kvm test Eduardo Habkost
2019-06-30 17:39 ` Cleber Rosa
2019-07-01 18:34 ` Eduardo Habkost
2019-07-01 20:29 ` Cleber Rosa
2019-07-05 15:43 ` Wainer dos Santos Moschetta
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=20190628150217.32659-4-wainersm@redhat.com \
--to=wainersm@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=jsnow@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).