From patchwork Thu Oct 4 15:14:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 978985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QxK943Yjz9s7W for ; Fri, 5 Oct 2018 01:15:25 +1000 (AEST) Received: from localhost ([::1]:56243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85LX-0005wU-3d for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2018 11:15:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47021) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85Kp-0005vl-8l for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g85Km-0006Bf-5W for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54254) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g85Kl-0006BD-VZ for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 47A6D3002710; Thu, 4 Oct 2018 15:14:35 +0000 (UTC) Received: from dhcp-17-10.bos.redhat.com (dhcp-17-10.bos.redhat.com [10.18.17.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CBAF1062258; Thu, 4 Oct 2018 15:14:34 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Thu, 4 Oct 2018 11:14:23 -0400 Message-Id: <20181004151429.7232-2-crosa@redhat.com> In-Reply-To: <20181004151429.7232-1-crosa@redhat.com> References: <20181004151429.7232-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 04 Oct 2018 15:14:35 +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 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Making it clear what is returned by this utility function. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé --- tests/acceptance/avocado_qemu/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_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 = os.uname()[4] qemu_bin_relative_path = os.path.join("%s-softmmu" % arch, From patchwork Thu Oct 4 15:14:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 978983 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QxK93MTsz9s5c for ; Fri, 5 Oct 2018 01:15:25 +1000 (AEST) Received: from localhost ([::1]:56242 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85LW-0005wL-T7 for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2018 11:15:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47020) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85Kp-0005vk-8a for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g85Kn-0006CX-Fe for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54278) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g85Kn-0006By-66 for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:37 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 752E530E6852; Thu, 4 Oct 2018 15:14:36 +0000 (UTC) Received: from dhcp-17-10.bos.redhat.com (dhcp-17-10.bos.redhat.com [10.18.17.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 691D81062253; Thu, 4 Oct 2018 15:14:35 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Thu, 4 Oct 2018 11:14:24 -0400 Message-Id: <20181004151429.7232-3-crosa@redhat.com> In-Reply-To: <20181004151429.7232-1-crosa@redhat.com> References: <20181004151429.7232-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 04 Oct 2018 15:14:36 +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 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 --- 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. +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 ~~~~~~~~ @@ -681,6 +692,13 @@ like the following: PARAMS (key=qemu_bin, path=*, default=x86_64-softmmu/qemu-system-x86_64) => 'x86_64-softmmu/qemu-system-x86_64 +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 ~~~~~~~~ diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py index d8d5b48dac..9329d9b9ec 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) -def pick_default_qemu_bin(): +def pick_default_qemu_bin(arch=None): """ Picks the path of a QEMU binary, starting either in the current working directory or in the source tree root directory. + :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`). + :param arch: str :returns: the path to the default QEMU binary or None if one could not be found :rtype: str or None """ - arch = os.uname()[4] + if arch is None: + arch = os.uname()[4] qemu_bin_relative_path = 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 = None + self.arch = self.params.get('arch', default=os.uname()[4]) self.qemu_bin = self.params.get('qemu_bin', - default=pick_default_qemu_bin()) + default=pick_default_qemu_bin(self.arch)) if self.qemu_bin is None: self.cancel("No QEMU binary defined or found in the source tree") self.vm = QEMUMachine(self.qemu_bin) From patchwork Thu Oct 4 15:14:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 978984 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QxK92wjtz9s4s for ; Fri, 5 Oct 2018 01:15:25 +1000 (AEST) Received: from localhost ([::1]:56244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85LW-0005wh-QI for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2018 11:15:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47019) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85Kp-0005vj-8Y for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g85Ko-0006D8-Dz for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58526) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g85Ko-0006Cm-7o for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:38 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8F4D688309; Thu, 4 Oct 2018 15:14:37 +0000 (UTC) Received: from dhcp-17-10.bos.redhat.com (dhcp-17-10.bos.redhat.com [10.18.17.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B0691062253; Thu, 4 Oct 2018 15:14:36 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Thu, 4 Oct 2018 11:14:25 -0400 Message-Id: <20181004151429.7232-4-crosa@redhat.com> In-Reply-To: <20181004151429.7232-1-crosa@redhat.com> References: <20181004151429.7232-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 04 Oct 2018 15:14:37 +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 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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é --- 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 = test_dir self._temp_dir = None self._launched = False + self._arch = None self._machine = None self._console_device_type = None self._console_address = None @@ -406,6 +407,12 @@ class QEMUMachine(object): ''' self._args.extend(args) + def set_arch(self, arch): + """ + Sets the architecture of this machine + """ + self._arch = arch + def set_machine(self, machine_type): ''' Sets the machine type From patchwork Thu Oct 4 15:14:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 978988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QxNr4nqwz9s5c for ; Fri, 5 Oct 2018 01:18:36 +1000 (AEST) Received: from localhost ([::1]:56260 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85Oa-0000Ih-Jm for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2018 11:18:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85Kq-0005w4-FD for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g85Kp-0006Dw-NJ for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52308) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g85Kp-0006DO-Ep for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:39 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AADA931524D3; Thu, 4 Oct 2018 15:14:38 +0000 (UTC) Received: from dhcp-17-10.bos.redhat.com (dhcp-17-10.bos.redhat.com [10.18.17.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A8A961062253; Thu, 4 Oct 2018 15:14:37 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Thu, 4 Oct 2018 11:14:26 -0400 Message-Id: <20181004151429.7232-5-crosa@redhat.com> In-Reply-To: <20181004151429.7232-1-crosa@redhat.com> References: <20181004151429.7232-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 04 Oct 2018 15:14:38 +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 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 = { r'^s390-ccw-virtio.*': 'sclpconsole', } +#: Maps archictures to the preferred machine type +MACHINE_TYPES = { + r'^aarch64$': 'virt', + r'^ppc$': 'g3beige', + r'^ppc64$': 'pseries', + r'^s390x$': 's390-ccw-virtio', + r'^x86_64$': 'q35', + } + class QEMUMachineError(Exception): """ @@ -413,13 +422,24 @@ class QEMUMachine(object): """ self._arch = arch - def set_machine(self, machine_type): + def set_machine(self, machine_type=None): ''' Sets the machine type 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 arch") + for regex, machine in MACHINE_TYPES.items(): + if re.match(regex, self._arch): + machine_type = machine + break + if machine_type is None: + raise QEMUMachineError("Can not set a machine type: no " + "matching machine type definition") self._machine = machine_type def set_console(self, device_type=None): From patchwork Thu Oct 4 15:14:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 978990 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QxNv361lz9s5c for ; Fri, 5 Oct 2018 01:18:39 +1000 (AEST) Received: from localhost ([::1]:56262 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85Oe-0000Ls-JH for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2018 11:18:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85Kr-0005wS-D7 for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g85Kq-0006EZ-Kc for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49216) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g85Kq-0006EB-Eh for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:40 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2DBD30001E1; Thu, 4 Oct 2018 15:14:39 +0000 (UTC) Received: from dhcp-17-10.bos.redhat.com (dhcp-17-10.bos.redhat.com [10.18.17.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C49671062253; Thu, 4 Oct 2018 15:14:38 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Thu, 4 Oct 2018 11:14:27 -0400 Message-Id: <20181004151429.7232-6-crosa@redhat.com> In-Reply-To: <20181004151429.7232-1-crosa@redhat.com> References: <20181004151429.7232-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Thu, 04 Oct 2018 15:14:39 +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 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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=aarch64 --filter-by-tags='-x86_64' -- tests/acceptance/ 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é Tested-by: Philippe Mathieu-Daudé --- 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 = '238e083e114c48200f80d889f7e32eeb2793e02a' kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) - self.vm.set_machine('pc') + self.vm.set_arch(self.arch) + self.vm.set_machine() self.vm.set_console() kernel_command_line = 'console=ttyS0' 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=quick """ def test_qmp_human_info_version(self): + self.vm.set_arch(self.arch) + self.vm.set_machine() self.vm.launch() res = self.vm.command('human-monitor-command', command_line='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=vnc,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() From patchwork Thu Oct 4 15:14:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 978989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QxNr4Ghbz9s4s for ; Fri, 5 Oct 2018 01:18:35 +1000 (AEST) Received: from localhost ([::1]:56259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85OZ-0000IP-Pk for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2018 11:18:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47084) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85Ks-0005xf-DP for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g85Kr-0006F7-OB for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28557) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g85Kr-0006Ei-IB for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:41 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCA8681DED; Thu, 4 Oct 2018 15:14:40 +0000 (UTC) Received: from dhcp-17-10.bos.redhat.com (dhcp-17-10.bos.redhat.com [10.18.17.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E01351062258; Thu, 4 Oct 2018 15:14:39 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Thu, 4 Oct 2018 11:14:28 -0400 Message-Id: <20181004151429.7232-7-crosa@redhat.com> In-Reply-To: <20181004151429.7232-1-crosa@redhat.com> References: <20181004151429.7232-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 04 Oct 2018 15:14:40 +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 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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=tests/acceptance/variants/arch.json \ --filter-by-tags='-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 | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/acceptance/variants/arch.json diff --git a/tests/acceptance/variants/arch.json b/tests/acceptance/variants/arch.json new file mode 100644 index 0000000000..a7a2570553 --- /dev/null +++ b/tests/acceptance/variants/arch.json @@ -0,0 +1 @@ +[{"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"}] From patchwork Thu Oct 4 15:14:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 978992 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42QxT5706vz9s5c for ; Fri, 5 Oct 2018 01:22:17 +1000 (AEST) Received: from localhost ([::1]:56283 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85SB-0003E1-J9 for incoming@patchwork.ozlabs.org; Thu, 04 Oct 2018 11:22:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47095) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g85Kt-0005yz-Lf for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g85Ks-0006FX-Sb for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53468) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g85Ks-0006FG-Mq for qemu-devel@nongnu.org; Thu, 04 Oct 2018 11:14:42 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06C4730832EE; Thu, 4 Oct 2018 15:14:42 +0000 (UTC) Received: from dhcp-17-10.bos.redhat.com (dhcp-17-10.bos.redhat.com [10.18.17.10]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A1491062253; Thu, 4 Oct 2018 15:14:40 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Thu, 4 Oct 2018 11:14:29 -0400 Message-Id: <20181004151429.7232-8-crosa@redhat.com> In-Reply-To: <20181004151429.7232-1-crosa@redhat.com> References: <20181004151429.7232-1-crosa@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 04 Oct 2018 15:14:42 +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 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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=tests/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 --- 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..2fb5da63cb 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 :avocado: enable - :avocado: tags=x86_64 """ timeout = 60 def test(self): + if self.arch != 'x86_64': + self.cancel('Currently specific to the x86_64 arch') kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/' 'Everything/x86_64/os/images/pxeboot/vmlinuz') kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'