qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, "Philippe Mathieu-Daudé" <philmd@linaro.org>
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Daniel P . Berrange" <berrange@redhat.com>
Subject: [PATCH 01/14] tests/functional: Add the LinuxKernelTest for testing the Linux boot process
Date: Fri,  6 Sep 2024 20:05:36 +0200	[thread overview]
Message-ID: <20240906180549.792832-2-thuth@redhat.com> (raw)
In-Reply-To: <20240906180549.792832-1-thuth@redhat.com>

Copy the LinuxKernelTest from tests/acceptance/boot_linux_console.py
to be able to convert the related tests to the functional test framework
in the following patches.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/functional/qemu_test/__init__.py    |  1 +
 tests/functional/qemu_test/linuxkernel.py | 41 +++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 tests/functional/qemu_test/linuxkernel.py

diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
index f33282efe8..67f87be9c4 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -12,3 +12,4 @@
     interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
     exec_command, exec_command_and_wait_for_pattern, get_qemu_img
 from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
+from .linuxkernel import LinuxKernelTest
diff --git a/tests/functional/qemu_test/linuxkernel.py b/tests/functional/qemu_test/linuxkernel.py
new file mode 100644
index 0000000000..fdd5307629
--- /dev/null
+++ b/tests/functional/qemu_test/linuxkernel.py
@@ -0,0 +1,41 @@
+# Test class for testing the boot process of a Linux kernel
+#
+# 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 .testcase import QemuSystemTest
+from .cmd import run_cmd, wait_for_console_pattern
+from .utils import archive_extract
+
+class LinuxKernelTest(QemuSystemTest):
+    KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+
+    def wait_for_console_pattern(self, success_message, vm=None):
+        wait_for_console_pattern(self, success_message,
+                                 failure_message='Kernel panic - not syncing',
+                                 vm=vm)
+
+    def extract_from_deb(self, deb_path, path):
+        """
+        Extracts a file from a deb package into the test workdir
+
+        :param deb_path: path to the deb archive
+        :param path: path within the deb archive of the file to be extracted
+        :returns: path of the extracted file
+        """
+        cwd = os.getcwd()
+        os.chdir(self.workdir)
+        (stdout, stderr, ret) = run_cmd(['ar', 't', deb_path])
+        file_path = stdout.split()[2]
+        run_cmd(['ar', 'x', deb_path, file_path])
+        archive_extract(file_path, self.workdir)
+        os.chdir(cwd)
+        # Return complete path to extracted file.  Because callers to
+        # extract_from_deb() specify 'path' with a leading slash, it is
+        # necessary to use os.path.relpath() as otherwise os.path.join()
+        # interprets it as an absolute path and drops the self.workdir part.
+        return os.path.normpath(os.path.join(self.workdir,
+                                             os.path.relpath(path, '/')))
+
-- 
2.46.0



  reply	other threads:[~2024-09-06 18:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 18:05 [PATCH 00/14] Convert Avocado tests based on LinuxKernelTest class Thomas Huth
2024-09-06 18:05 ` Thomas Huth [this message]
2024-09-07  4:43   ` [PATCH 01/14] tests/functional: Add the LinuxKernelTest for testing the Linux boot process Philippe Mathieu-Daudé
2024-09-06 18:05 ` [PATCH 02/14] tests/functional: Convert the m68k Q800 Avocado test into a functional test Thomas Huth
2024-09-07  4:36   ` Philippe Mathieu-Daudé
2024-09-06 18:05 ` [PATCH 03/14] tests/functional: Convert mips64el Fuloong2e avocado test (2/2) Thomas Huth
2024-09-06 18:05 ` [PATCH 04/14] tests/functional: Convert mips64el I6400 Malta avocado tests Thomas Huth
2024-09-06 18:05 ` [PATCH 05/14] tests/functional: Convert mips64el 5KEc " Thomas Huth
2024-09-06 18:05 ` [PATCH 06/14] tests/functional: Convert mips32el Malta YAMON avocado test Thomas Huth
2024-09-06 18:05 ` [PATCH 07/14] tests/functional: Convert nanomips Malta avocado tests Thomas Huth
2024-09-06 18:05 ` [PATCH 08/14] tests/functional: Convert mips32eb 4Kc " Thomas Huth
2024-09-06 18:05 ` [PATCH 09/14] tests/functional: Convert ARM Raspi2 " Thomas Huth
2024-09-06 18:05 ` [PATCH 10/14] tests/functional: Convert Aarch64 Raspi3 " Thomas Huth
2024-09-06 18:05 ` [PATCH 11/14] tests/functional: Convert Aarch64 Raspi4 " Thomas Huth
2024-09-06 18:05 ` [PATCH 12/14] tests/functional: Convert the Alpha Clipper Avocado test Thomas Huth
2024-09-07  4:30   ` Philippe Mathieu-Daudé
2024-09-06 18:05 ` [PATCH 13/14] tests/functional: Convert the m68k MCF5208EVB " Thomas Huth
2024-09-07  4:32   ` Philippe Mathieu-Daudé
2024-09-06 18:05 ` [PATCH 14/14] tests/functional: Convert the or1k-sim " Thomas Huth
2024-09-07  4:37   ` Philippe Mathieu-Daudé

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=20240906180549.792832-2-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=philmd@linaro.org \
    --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).