From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Wainer dos Santos Moschetta" <wainersm@redhat.com>,
"Cleber Rosa" <crosa@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Beraldo Leal" <bleal@redhat.com>
Subject: [PATCH 1/3] tests/functional: Add QemuUserTest class
Date: Thu, 22 Aug 2024 12:42:36 +0200 [thread overview]
Message-ID: <20240822104238.75045-2-philmd@linaro.org> (raw)
In-Reply-To: <20240822104238.75045-1-philmd@linaro.org>
Per commit 5334df4822 ("tests/avocado: Introduce
QemuUserTest base class"):
Similarly to the 'System' Test base class with methods
for testing system emulation, the QemuUserTest class
contains methods useful to test user-mode emulation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/functional/qemu_test/__init__.py | 2 +-
tests/functional/qemu_test/testcase.py | 17 +++++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/tests/functional/qemu_test/__init__.py b/tests/functional/qemu_test/__init__.py
index db05c8f412..6e9b017264 100644
--- a/tests/functional/qemu_test/__init__.py
+++ b/tests/functional/qemu_test/__init__.py
@@ -11,4 +11,4 @@
from .cmd import has_cmd, has_cmds, run_cmd, is_readable_executable_file, \
interrupt_interactive_console_until_pattern, wait_for_console_pattern, \
exec_command, exec_command_and_wait_for_pattern
-from .testcase import QemuSystemTest, QemuBaseTest
+from .testcase import QemuBaseTest, QemuUserTest, QemuSystemTest
diff --git a/tests/functional/qemu_test/testcase.py b/tests/functional/qemu_test/testcase.py
index 18314be9d1..aa0146265a 100644
--- a/tests/functional/qemu_test/testcase.py
+++ b/tests/functional/qemu_test/testcase.py
@@ -13,6 +13,7 @@
import logging
import os
+import subprocess
import pycotap
import sys
import unittest
@@ -70,6 +71,22 @@ def main():
unittest.main(module = None, testRunner = tr, argv=["__dummy__", path])
+class QemuUserTest(QemuBaseTest):
+
+ def setUp(self):
+ super().setUp('qemu-')
+ self._ldpath = []
+
+ def add_ldpath(self, ldpath):
+ self._ldpath.append(os.path.abspath(ldpath))
+
+ def run_cmd(self, bin_path, args=[]):
+ return subprocess.run([self.qemu_bin]
+ + ["-L %s" % ldpath for ldpath in self._ldpath]
+ + [bin_path]
+ + args,
+ text=True, capture_output=True)
+
class QemuSystemTest(QemuBaseTest):
"""Facilitates system emulation tests."""
--
2.45.2
next prev parent reply other threads:[~2024-08-22 10:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 10:42 [PATCH 0/3] tests/functional: Convert ARM bFLT linux-user avocado test Philippe Mathieu-Daudé
2024-08-22 10:42 ` Philippe Mathieu-Daudé [this message]
2024-08-22 13:54 ` [PATCH 1/3] tests/functional: Add QemuUserTest class Thomas Huth
2024-08-22 10:42 ` [PATCH 2/3] tests/functional: Convert ARM bFLT linux-user avocado test Philippe Mathieu-Daudé
2024-08-22 10:42 ` [PATCH 3/3] tests/avocado: Remove unused QemuUserTest class Philippe Mathieu-Daudé
2024-08-22 13:55 ` Thomas Huth
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=20240822104238.75045-2-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=bleal@redhat.com \
--cc=crosa@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=thuth@redhat.com \
--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).