From patchwork Tue Oct 9 23:26:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10633391 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5CD7112B for ; Tue, 9 Oct 2018 23:27:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7A7F29B1F for ; Tue, 9 Oct 2018 23:27:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB7A629B8D; Tue, 9 Oct 2018 23:27:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 663C829B1F for ; Tue, 9 Oct 2018 23:27:41 +0000 (UTC) Received: from localhost ([::1]:54160 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1Pg-0004F2-35 for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Oct 2018 19:27:40 -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) 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Tue Oct 9 23:26:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10633399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6A9EF112B for ; Tue, 9 Oct 2018 23:29:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C0C029B7D for ; Tue, 9 Oct 2018 23:29:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 506D129B88; Tue, 9 Oct 2018 23:29:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E3FAC29B7D for ; Tue, 9 Oct 2018 23:29:58 +0000 (UTC) Received: from localhost ([::1]:54171 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1Ru-0005r0-7K for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Oct 2018 19:29:58 -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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é Tested-by: Philippe Mathieu-Daudé --- 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..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) -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`). + :type 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 Tue Oct 9 23:26:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10633393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CCC42112B for ; Tue, 9 Oct 2018 23:27:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCFA729B1F for ; Tue, 9 Oct 2018 23:27:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B187729B8D; Tue, 9 Oct 2018 23:27:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 69FA729B1F for ; Tue, 9 Oct 2018 23:27:43 +0000 (UTC) Received: from localhost ([::1]:54161 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1Pi-0004H6-MW for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Oct 2018 19:27:42 -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) 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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é Tested-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 Tue Oct 9 23:26:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10633397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3BEB0112B for ; Tue, 9 Oct 2018 23:29:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22DC029B7D for ; Tue, 9 Oct 2018 23:29:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 124B029B88; Tue, 9 Oct 2018 23:29:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 90D4729B7D for ; Tue, 9 Oct 2018 23:29:55 +0000 (UTC) Received: from localhost ([::1]:54170 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1Rq-0005o0-TX for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Oct 2018 19:29:54 -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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Tue Oct 9 23:26:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10633403 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7291E13AD for ; Tue, 9 Oct 2018 23:33:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 606F329C10 for ; Tue, 9 Oct 2018 23:33:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 513C829C14; Tue, 9 Oct 2018 23:33:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id CD0D329C10 for ; Tue, 9 Oct 2018 23:33:08 +0000 (UTC) Received: from localhost ([::1]:54185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1Ux-0007XD-GV for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Oct 2018 19:33:07 -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) 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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Tue Oct 9 23:26:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10633401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 33A1315E2 for ; Tue, 9 Oct 2018 23:31:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D9E129B93 for ; Tue, 9 Oct 2018 23:31:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1067B29C23; Tue, 9 Oct 2018 23:31:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B41E829B93 for ; Tue, 9 Oct 2018 23:31:48 +0000 (UTC) Received: from localhost ([::1]:54182 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1Tg-0006oS-0o for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Oct 2018 19:31:48 -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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 | 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/variants/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" + } +] From patchwork Tue Oct 9 23:26:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cleber Rosa X-Patchwork-Id: 10633405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E905713AD for ; Tue, 9 Oct 2018 23:34:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D98EE29BCC for ; Tue, 9 Oct 2018 23:34:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD2DB29C10; Tue, 9 Oct 2018 23:34:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7BF0329BCC for ; Tue, 9 Oct 2018 23:34:25 +0000 (UTC) Received: from localhost ([::1]:54188 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gA1WC-00088a-QN for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Oct 2018 19:34:24 -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_Mathieu-Daud=C3=A9?= , Stefan Hajnoczi , Caio Carrara , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé --- 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 :avocado: enable - :avocado: tags=x86_64 """ timeout = 60 def test(self): + if self.arch != 'x86_64': + self.cancel('Currently specific to the x86_64 target arch') kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/' 'Everything/x86_64/os/images/pxeboot/vmlinuz') kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'