From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: qemu-devel@nongnu.org, crosa@redhat.com
Cc: peter.maydell@linaro.org, ehabkost@redhat.com
Subject: [Qemu-devel] [RFC PATCH] tests/acceptance: Handle machine type for ARM target
Date: Fri, 21 Jun 2019 11:38:06 -0400 [thread overview]
Message-ID: <20190621153806.13489-1-wainersm@redhat.com> (raw)
Hi all,
I'm still unsure this is the best solution. I tend to think that
any arch-independent test case (i.e. not tagged 'arch') should
be skipped on all arches except for x86_64. Opening up for
discussion though.
Note: It was decided that ARM targets should not default to any
machine type: https://www.mail-archive.com/qemu-devel@nongnu.org/msg625999.html
-- 8< --
Some tests are meant arch-independent and as such they don't set
the machine type (i.e. relying to defaults) on launched VMs. The arm
targets, however, don't provide any default machine so tests fail.
This patch adds a logic on the base Test class so that machine type
is set to 'virt' when:
a) The test case doesn't have arch:aarch64 or arch:arm tag. Here
I assume that if the test was tagged for a specific arch then
the writer took care of setting a machine type.
b) The target binary arch is any of aarch64 or arm. Note:
self.target_arch can end up None if qemu_bin is passed by
Avocado parameter and the filename doesn't match expected
format. In this case the test will fail.
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
tests/acceptance/avocado_qemu/__init__.py | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 2b236a1cf0..fb3e0dc2bc 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -9,6 +9,7 @@
# later. See the COPYING file in the top-level directory.
import os
+import re
import sys
import uuid
@@ -65,10 +66,21 @@ class Test(avocado.Test):
if self.qemu_bin is None:
self.cancel("No QEMU binary defined or found in the source tree")
+ m = re.match('qemu-system-(.*)', self.qemu_bin.split('/').pop())
+ if m:
+ self.target_arch = m.group(1)
+ else:
+ self.target_arch = None
+
def _new_vm(self, *args):
vm = QEMUMachine(self.qemu_bin)
if args:
vm.add_args(*args)
+ # Handle lack of default machine type on some targets.
+ # Assume that arch tagged tests have machine type set properly.
+ if self.tags.get('arch') is None and \
+ self.target_arch in ('aarch64', 'arm'):
+ vm.set_machine('virt')
return vm
@property
--
2.18.1
next reply other threads:[~2019-06-21 15:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-21 15:38 Wainer dos Santos Moschetta [this message]
2019-06-21 22:07 ` [Qemu-devel] [RFC PATCH] tests/acceptance: Handle machine type for ARM target Cleber Rosa
2019-06-27 20:36 ` Wainer dos Santos Moschetta
2019-06-21 22:56 ` [Qemu-devel] [RFC PATCH] Acceptance tests: run generic tests on all built targets Cleber Rosa
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=20190621153806.13489-1-wainersm@redhat.com \
--to=wainersm@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=peter.maydell@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).