From nobody Sun May 19 20:29:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539127700768647.7175982733175; Tue, 9 Oct 2018 16:28:20 -0700 (PDT) Received: from localhost ([::1]:54160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1QB-0004F2-0s for importer@patchew.org; Tue, 09 Oct 2018 19:28:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1OW-0003N1-Gb for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gA1OV-0000ni-Im for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48276) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gA1OS-0000jc-2a for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:24 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DB12E81DE9; Tue, 9 Oct 2018 23:26:17 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-120-82.rdu2.redhat.com [10.10.120.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 977ED7E3AD; Tue, 9 Oct 2018 23:26:16 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2018 19:26:01 -0400 Message-Id: <20181009232607.15521-2-crosa@redhat.com> In-Reply-To: <20181009232607.15521-1-crosa@redhat.com> References: <20181009232607.15521-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 09 Oct 2018 23:26:17 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/7] Acceptance Tests: improve docstring on pick_default_qemu_bin() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Eduardo Habkost , Laszlo Ersek , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Making it clear what is returned by this utility function. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- tests/acceptance/avocado_qemu/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 1e54fd5932..d8d5b48dac 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -27,6 +27,10 @@ def pick_default_qemu_bin(): """ Picks the path of a QEMU binary, starting either in the current working directory or in the source tree root directory. + + :returns: the path to the default QEMU binary or None if one could not + be found + :rtype: str or None """ arch =3D os.uname()[4] qemu_bin_relative_path =3D os.path.join("%s-softmmu" % arch, --=20 2.17.1 From nobody Sun May 19 20:29:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539127824655321.88059972206065; Tue, 9 Oct 2018 16:30:24 -0700 (PDT) Received: from localhost ([::1]:54171 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1SJ-0005r0-O0 for importer@patchew.org; Tue, 09 Oct 2018 19:30:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1OX-0003N2-6Y for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gA1OV-0000o8-TH for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37744) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gA1OV-0000kH-Hm for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:27 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57BE037E74; Tue, 9 Oct 2018 23:26:19 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-120-82.rdu2.redhat.com [10.10.120.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 115047E12B; Tue, 9 Oct 2018 23:26:17 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2018 19:26:02 -0400 Message-Id: <20181009232607.15521-3-crosa@redhat.com> In-Reply-To: <20181009232607.15521-1-crosa@redhat.com> References: <20181009232607.15521-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 09 Oct 2018 23:26:19 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/7] Acceptance Tests: introduce arch parameter and attribute X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Eduardo Habkost , Laszlo Ersek , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" On a number of different scenarios, such as when choosing a QEMU binary to be used on tests (or a image to use to boot a test VM), it's useful to define the architecture that should be used. This introduces both a test parameter and a test instance attribute, that will contain such a value. The selection of the default QEMU binary, if one is not given explicitly, has also been changed to look at the arch attribute. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- docs/devel/testing.rst | 18 ++++++++++++++++++ tests/acceptance/avocado_qemu/__init__.py | 13 ++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 727c4019b5..4178ae5022 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -659,6 +659,17 @@ vm A QEMUMachine instance, initially configured according to the given ``qemu_bin`` parameter. =20 +arch +~~~~ + +The architecture that will be used on a number of different +scenarios. For instance, when a QEMU binary is not explicitly given, +the one selected will depend on this attribute. + +The ``arch`` attribute will be set to the test parameter of the same +name, and if one is not given explicitly, it will default to the +system architecture (as given by ``uname``). + qemu_bin ~~~~~~~~ =20 @@ -681,6 +692,13 @@ like the following: =20 PARAMS (key=3Dqemu_bin, path=3D*, default=3Dx86_64-softmmu/qemu-system-x= 86_64) =3D> 'x86_64-softmmu/qemu-system-x86_64 =20 +arch +~~~~ + +The architecture that will be used on a number of different scenarios. +This parameter has a direct relation with the ``arch`` attribute. If +not given, it will default to None. + qemu_bin ~~~~~~~~ =20 diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index d8d5b48dac..b8d934382d 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -23,16 +23,22 @@ def is_readable_executable_file(path): return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK) =20 =20 -def pick_default_qemu_bin(): +def pick_default_qemu_bin(arch=3DNone): """ Picks the path of a QEMU binary, starting either in the current working directory or in the source tree root directory. =20 + :param arch: the arch to use when looking for a QEMU binary (the target + will match the arch given). If None (the default) arch + will be the current host system arch (as given by + :func:`os.uname`). + :type arch: str :returns: the path to the default QEMU binary or None if one could not be found :rtype: str or None """ - arch =3D os.uname()[4] + if arch is None: + arch =3D os.uname()[4] qemu_bin_relative_path =3D os.path.join("%s-softmmu" % arch, "qemu-system-%s" % arch) if is_readable_executable_file(qemu_bin_relative_path): @@ -47,8 +53,9 @@ def pick_default_qemu_bin(): class Test(avocado.Test): def setUp(self): self.vm =3D None + self.arch =3D self.params.get('arch', default=3Dos.uname()[4]) self.qemu_bin =3D self.params.get('qemu_bin', - default=3Dpick_default_qemu_bin()) + default=3Dpick_default_qemu_bin(se= lf.arch)) if self.qemu_bin is None: self.cancel("No QEMU binary defined or found in the source tre= e") self.vm =3D QEMUMachine(self.qemu_bin) --=20 2.17.1 From nobody Sun May 19 20:29:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 15391277016650.07527691311281615; Tue, 9 Oct 2018 16:28:21 -0700 (PDT) Received: from localhost ([::1]:54161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1QC-0004H6-BG for importer@patchew.org; Tue, 09 Oct 2018 19:28:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35941) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1OW-0003N0-GQ for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gA1OV-0000ne-Ib for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37748) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gA1OS-0000kr-3M for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:24 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C4FC2FEC9; Tue, 9 Oct 2018 23:26:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-120-82.rdu2.redhat.com [10.10.120.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 827E67E12B; Tue, 9 Oct 2018 23:26:19 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2018 19:26:03 -0400 Message-Id: <20181009232607.15521-4-crosa@redhat.com> In-Reply-To: <20181009232607.15521-1-crosa@redhat.com> References: <20181009232607.15521-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 09 Oct 2018 23:26:20 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/7] scripts/qemu.py: add method and private attribute for arch X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Eduardo Habkost , Laszlo Ersek , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Because some sane defaults may require the knowledge of the arch, let's give the QEMUMachine the opportunity to hold that information. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- scripts/qemu.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/qemu.py b/scripts/qemu.py index f099ce7278..d9e24a0c1a 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -113,6 +113,7 @@ class QEMUMachine(object): self._test_dir =3D test_dir self._temp_dir =3D None self._launched =3D False + self._arch =3D None self._machine =3D None self._console_device_type =3D None self._console_address =3D None @@ -406,6 +407,12 @@ class QEMUMachine(object): ''' self._args.extend(args) =20 + def set_arch(self, arch): + """ + Sets the architecture of this machine + """ + self._arch =3D arch + def set_machine(self, machine_type): ''' Sets the machine type --=20 2.17.1 From nobody Sun May 19 20:29:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539127814796613.9382729036664; Tue, 9 Oct 2018 16:30:14 -0700 (PDT) Received: from localhost ([::1]:54170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1S9-0005o0-RE for importer@patchew.org; Tue, 09 Oct 2018 19:30:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35995) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1OX-0003NC-Iz for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gA1OW-0000or-9N for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57824) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gA1OV-0000lO-Uz for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:28 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41E20A6DE0; Tue, 9 Oct 2018 23:26:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-120-82.rdu2.redhat.com [10.10.120.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F028A7E12B; Tue, 9 Oct 2018 23:26:20 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2018 19:26:04 -0400 Message-Id: <20181009232607.15521-5-crosa@redhat.com> In-Reply-To: <20181009232607.15521-1-crosa@redhat.com> References: <20181009232607.15521-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 09 Oct 2018 23:26:22 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/7] scripts/qemu.py: set predefined machine type based on arch X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Eduardo Habkost , Laszlo Ersek , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Some targets require a machine type to be set, as there's no default (aarch64 is one example). To give a consistent interface to users of this API, this changes set_machine() so that a predefined default can be used, if one is not given. The approach used is exactly the same with the console device type. Also, even when there's a default machine type, for some purposes, testing included, it's better if outside code is explicit about the machine type, instead of relying on whatever is set internally. Signed-off-by: Cleber Rosa --- scripts/qemu.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/scripts/qemu.py b/scripts/qemu.py index d9e24a0c1a..fca9b76990 100644 --- a/scripts/qemu.py +++ b/scripts/qemu.py @@ -36,6 +36,15 @@ CONSOLE_DEV_TYPES =3D { r'^s390-ccw-virtio.*': 'sclpconsole', } =20 +#: Maps archictures to the preferred machine type +MACHINE_TYPES =3D { + r'^aarch64$': 'virt', + r'^ppc$': 'g3beige', + r'^ppc64$': 'pseries', + r'^s390x$': 's390-ccw-virtio', + r'^x86_64$': 'q35', + } + =20 class QEMUMachineError(Exception): """ @@ -413,13 +422,24 @@ class QEMUMachine(object): """ self._arch =3D arch =20 - def set_machine(self, machine_type): + def set_machine(self, machine_type=3DNone): ''' Sets the machine type =20 If set, the machine type will be added to the base arguments of the resulting QEMU command line. ''' + if machine_type is None: + if self._arch is None: + raise QEMUMachineError("Can not set a default machine type= : " + "QEMU instance without a defined ar= ch") + for regex, machine in MACHINE_TYPES.items(): + if re.match(regex, self._arch): + machine_type =3D machine + break + if machine_type is None: + raise QEMUMachineError("Can not set a machine type: no " + "matching machine type definition") self._machine =3D machine_type =20 def set_console(self, device_type=3DNone): --=20 2.17.1 From nobody Sun May 19 20:29:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539128012493269.591920635104; Tue, 9 Oct 2018 16:33:32 -0700 (PDT) Received: from localhost ([::1]:54185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1VC-0007XD-4J for importer@patchew.org; Tue, 09 Oct 2018 19:33:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1OX-0003ND-J7 for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gA1OW-0000oy-AZ for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41956) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gA1OV-0000mO-U6 for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:28 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B272E3082E4E; Tue, 9 Oct 2018 23:26:23 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-120-82.rdu2.redhat.com [10.10.120.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6EB867E3AD; Tue, 9 Oct 2018 23:26:22 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2018 19:26:05 -0400 Message-Id: <20181009232607.15521-6-crosa@redhat.com> In-Reply-To: <20181009232607.15521-1-crosa@redhat.com> References: <20181009232607.15521-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 09 Oct 2018 23:26:24 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 5/7] Acceptance Tests: set machine type X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Eduardo Habkost , Laszlo Ersek , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" By setting the machine type, even if it's the one that will be picked based on the arch, it's possible to run the same tests with targets that require a machine type (in addition to those that don't). Given that only boot_linux_console.py contains code specific to x86_64 (an explicit reference to the kernel image that will be used) the other tests can be used to test different targets: $ avocado run -p arch=3Daarch64 --filter-by-tags=3D'-x86_64' -- tests/acc= eptance/ Eventually, to reduce boiler plate code, the idea is to concentrate the basic configuration (arch, machine, console) in either another utility method, or make that happen by default. This is of course the subject of a future discussion. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- tests/acceptance/boot_linux_console.py | 3 ++- tests/acceptance/version.py | 2 ++ tests/acceptance/vnc.py | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 98324f7591..58032f971c 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -30,7 +30,8 @@ class BootLinuxConsole(Test): kernel_hash =3D '238e083e114c48200f80d889f7e32eeb2793e02a' kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) =20 - self.vm.set_machine('pc') + self.vm.set_arch(self.arch) + self.vm.set_machine() self.vm.set_console() kernel_command_line =3D 'console=3DttyS0' self.vm.add_args('-kernel', kernel_path, diff --git a/tests/acceptance/version.py b/tests/acceptance/version.py index 13b0a7440d..7a3a20945f 100644 --- a/tests/acceptance/version.py +++ b/tests/acceptance/version.py @@ -18,6 +18,8 @@ class Version(Test): :avocado: tags=3Dquick """ def test_qmp_human_info_version(self): + self.vm.set_arch(self.arch) + self.vm.set_machine() self.vm.launch() res =3D self.vm.command('human-monitor-command', command_line=3D'info version') diff --git a/tests/acceptance/vnc.py b/tests/acceptance/vnc.py index b1ef9d71b1..4a8a83025f 100644 --- a/tests/acceptance/vnc.py +++ b/tests/acceptance/vnc.py @@ -16,6 +16,11 @@ class Vnc(Test): :avocado: enable :avocado: tags=3Dvnc,quick """ + def setUp(self): + super(Vnc, self).setUp() + self.vm.set_arch(self.arch) + self.vm.set_machine() + def test_no_vnc(self): self.vm.add_args('-nodefaults', '-S') self.vm.launch() --=20 2.17.1 From nobody Sun May 19 20:29:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539127920886717.4581161867148; Tue, 9 Oct 2018 16:32:00 -0700 (PDT) Received: from localhost ([::1]:54182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1Tr-0006oS-Vb for importer@patchew.org; Tue, 09 Oct 2018 19:31:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1OX-0003N7-GK for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gA1OW-0000ok-7x for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39934) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gA1OV-0000mf-QD for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:28 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 36BB93082143; Tue, 9 Oct 2018 23:26:25 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-120-82.rdu2.redhat.com [10.10.120.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF40E7E3B3; Tue, 9 Oct 2018 23:26:23 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2018 19:26:06 -0400 Message-Id: <20181009232607.15521-7-crosa@redhat.com> In-Reply-To: <20181009232607.15521-1-crosa@redhat.com> References: <20181009232607.15521-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 09 Oct 2018 23:26:25 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 6/7] Acceptance Tests: add variants definition for architectures X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Eduardo Habkost , Laszlo Ersek , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" One of the Avocado features relevant to virtualization testing is the ability to reuse tests in different scenarios, known as variants. This adds a JSON based variants file, that can be used to run most tests in a number of different architectures. It can be run with: $ avocado run \ --json-variants-load=3Dtests/acceptance/variants/arch.json \ --filter-by-tags=3D'-x86_64' -- tests/acceptance/ Currently this covers 5 architectures, resulting in the execution of 25 different combinations. Signed-off-by: Cleber Rosa --- tests/acceptance/variants/arch.json | 92 +++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 tests/acceptance/variants/arch.json diff --git a/tests/acceptance/variants/arch.json b/tests/acceptance/variant= s/arch.json new file mode 100644 index 0000000000..64ff6ad278 --- /dev/null +++ b/tests/acceptance/variants/arch.json @@ -0,0 +1,92 @@ +[ + { + "paths": [ + "/run/*" + ], + "variant": [ + [ + "/run/aarch64", + [ + [ + "/run/aarch64", + "arch", + "aarch64" + ] + ] + ] + ], + "variant_id": "aarch64" + }, + { + "paths": [ + "/run/*" + ], + "variant": [ + [ + "/run/ppc", + [ + [ + "/run/ppc", + "arch", + "ppc" + ] + ] + ] + ], + "variant_id": "ppc" + }, + { + "paths": [ + "/run/*" + ], + "variant": [ + [ + "/run/ppc64", + [ + [ + "/run/ppc64", + "arch", + "ppc64" + ] + ] + ] + ], + "variant_id": "ppc64" + }, + { + "paths": [ + "/run/*" + ], + "variant": [ + [ + "/run/s390x", + [ + [ + "/run/s390x", + "arch", + "s390x" + ] + ] + ] + ], + "variant_id": "s390x" + }, + { + "paths": [ + "/run/*" + ], + "variant": [ + [ + "/run/x86_64", + [ + [ + "/run/x86_64", + "arch", + "x86_64" + ] + ] + ] + ], + "variant_id": "x86_64" + } +] --=20 2.17.1 From nobody Sun May 19 20:29:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15391280780331015.6942437941975; Tue, 9 Oct 2018 16:34:38 -0700 (PDT) Received: from localhost ([::1]:54188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1WP-00088a-1C for importer@patchew.org; Tue, 09 Oct 2018 19:34:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1OX-0003NJ-W6 for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gA1OW-0000p6-Dg for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46124) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gA1OW-0000nJ-4S for qemu-devel@nongnu.org; Tue, 09 Oct 2018 19:26:28 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A662DC04B2E8; Tue, 9 Oct 2018 23:26:26 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-120-82.rdu2.redhat.com [10.10.120.82]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5B2097E12B; Tue, 9 Oct 2018 23:26:25 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Tue, 9 Oct 2018 19:26:07 -0400 Message-Id: <20181009232607.15521-8-crosa@redhat.com> In-Reply-To: <20181009232607.15521-1-crosa@redhat.com> References: <20181009232607.15521-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 09 Oct 2018 23:26:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 7/7] Acceptance Tests: change the handling of tests for specific archs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Eduardo Habkost , Laszlo Ersek , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?UTF-8?q?Alex=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" With the introduction of a variants file that can run the same tests on various architectures, it makes sense to make most tests to be reusable on those environments. The exception should be when a test is really testing a specific architecture feature. With the change proposed here, on a command line such as: $ avocado run \ --json-variants-load=3Dtests/acceptance/variants/arch.json \ -- tests/acceptance/ The boot_linux_console.py tests will appear as "CANCELED: Currently specific to the x86_64 arch", which is as a good thing when compared to being ignored by tags because: * The architecture specific parts can be addressed * It will be run on the matching architecture (as opposed to always being filtered out by the tags mechanism) * CANCELED tests do no influence negatively the overall job results, they're not considered an error or failure Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- tests/acceptance/boot_linux_console.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 58032f971c..ba3ac036da 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -19,12 +19,13 @@ class BootLinuxConsole(Test): and the kernel command line is properly passed from QEMU to the kernel =20 :avocado: enable - :avocado: tags=3Dx86_64 """ =20 timeout =3D 60 =20 def test(self): + if self.arch !=3D 'x86_64': + self.cancel('Currently specific to the x86_64 target arch') kernel_url =3D ('https://mirrors.kernel.org/fedora/releases/28/' 'Everything/x86_64/os/images/pxeboot/vmlinuz') kernel_hash =3D '238e083e114c48200f80d889f7e32eeb2793e02a' --=20 2.17.1