qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Mark Cave-Ayland" <mark.cave-ayland@ilande.co.uk>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Magnus Damm" <magnus.damm@gmail.com>,
	"Max Filippov" <jcmvbkbc@gmail.com>
Subject: [PATCH 1/7] tests/functional/qemu_test: Add a function for launching kernels more easily
Date: Thu, 19 Sep 2024 20:57:41 +0200	[thread overview]
Message-ID: <20240919185749.71222-2-thuth@redhat.com> (raw)
In-Reply-To: <20240919185749.71222-1-thuth@redhat.com>

The task for launching a kernel is quite repetitive: Set the serial
console, set the -kernel and maybe -initrd and -dtb parameters,
launch the VM and then wait for the expected console output. So
it's easier in some tests to provide these steps via a separate
function.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/linuxkernel.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/qemu_test/linuxkernel.py
index fdd5307629..2b5b9a5fda 100644
--- a/tests/functional/qemu_test/linuxkernel.py
+++ b/tests/functional/qemu_test/linuxkernel.py
@@ -17,6 +17,18 @@ def wait_for_console_pattern(self, success_message, vm=None):
                                  failure_message='Kernel panic - not syncing',
                                  vm=vm)
 
+    def launch_kernel(self, kernel, initrd=None, dtb=None, console_index=0,
+                      wait_for=None):
+        self.vm.set_console(console_index=console_index)
+        self.vm.add_args('-kernel', kernel)
+        if initrd:
+                self.vm.add_args('-initrd', initrd)
+        if dtb:
+                self.vm.add_args('-dtb', dtb)
+        self.vm.launch()
+        if wait_for:
+                self.wait_for_console_pattern(wait_for)
+
     def extract_from_deb(self, deb_path, path):
         """
         Extracts a file from a deb package into the test workdir
-- 
2.46.0



  reply	other threads:[~2024-09-19 18:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-19 18:57 [PATCH 0/7] tests/functional: Convert the advent calendar tests Thomas Huth
2024-09-19 18:57 ` Thomas Huth [this message]
2024-09-19 18:57 ` [PATCH 2/7] tests/functional: Convert the vexpressa9 Avocado test Thomas Huth
2024-09-19 18:57 ` [PATCH 3/7] tests/functional: Convert the xtensa lx60 " Thomas Huth
2024-09-19 18:57 ` [PATCH 4/7] tests/functional: Convert the SPARCStation " Thomas Huth
2024-09-22 12:44   ` Mark Cave-Ayland
2024-09-19 18:57 ` [PATCH 5/7] tests/functional: Convert the e500 ppc64 " Thomas Huth
2024-09-19 18:57 ` [PATCH 6/7] tests/functional: Convert the mac ppc Avocado tests Thomas Huth
2024-09-22 12:45   ` Mark Cave-Ayland
2024-09-19 18:57 ` [PATCH 7/7] tests/functional: Convert the r2d sh4 Avocado test Thomas Huth
2024-09-22  4:51 ` [PATCH 0/7] tests/functional: Convert the advent calendar tests Richard Henderson

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=20240919185749.71222-2-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=magnus.damm@gmail.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=ysato@users.sourceforge.jp \
    /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).