From nobody Sat Feb 7 05:49:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1552412364707185.23307654056498; Tue, 12 Mar 2019 10:39:24 -0700 (PDT) Received: from localhost ([127.0.0.1]:56552 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3lN3-0007PK-HB for importer@patchew.org; Tue, 12 Mar 2019 13:39:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h3l38-00066w-2h for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:18:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h3l37-0006lx-0J for qemu-devel@nongnu.org; Tue, 12 Mar 2019 13:18:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64118) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h3l36-0006kr-LA; Tue, 12 Mar 2019 13:18:44 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CB11F1FA6BB; Tue, 12 Mar 2019 17:18:43 +0000 (UTC) Received: from dhcp-17-165.bos.redhat.com (dhcp-17-165.bos.redhat.com [10.18.17.165]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6AE41600D7; Tue, 12 Mar 2019 17:18:42 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Date: Tue, 12 Mar 2019 13:18:10 -0400 Message-Id: <20190312171824.5134-7-crosa@redhat.com> In-Reply-To: <20190312171824.5134-1-crosa@redhat.com> References: <20190312171824.5134-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 12 Mar 2019 17:18:43 +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 v5 06/20] Acceptance tests: look for target architecture in test tags first 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 , Stefan Markovic , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Cornelia Huck , Markus Armbruster , Wainer dos Santos Moschetta , Aleksandar Rikalo , qemu-s390x@nongnu.org, Aleksandar Markovic , Cleber Rosa , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Aurelien Jarno Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" A test can, optionally, be tagged for one or many architectures. If a test has been tagged for a single architecture, there's a high chance that the test won't run on other architectures. This changes the default order of choosing a default target architecture to use based on the 'arch' tag value first. The precedence order is for choosing a QEMU binary to use for a test is now: * qemu_bin parameter * arch parameter * arch tag value (for example, x86_64 if ":avocado: tags=3Darch:x86_64 is used) This means that if one runs: $ avocado run -p qemu_bin=3D/usr/bin/qemu-system-x86_64 test.py No arch parameter or tag will influence the selection of the QEMU target binary. If one runs: $ avocado run -p arch=3Dppc64 test.py The target binary selection mechanism will attempt to find a binary such as "ppc64-softmmu/qemu-system-ppc64". And finally, if one runs a test that is tagged (in its docstring) with "arch:aarch64": $ avocado run aarch64.py The target binary selection mechanism will attempt to find a binary such as "aarch64-softmmu/qemu-system-aarch64". At this time, no provision is made to cancel the execution of tests if the arch parameter given (manually) does not match the test "arch" tag, but it may be a useful default behavior to be added in the future. Signed-off-by: Cleber Rosa Reviewed-by: Cornelia Huck --- docs/devel/testing.rst | 4 +++- tests/acceptance/avocado_qemu/__init__.py | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 83bf9f09ac..da2d0fc964 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -740,7 +740,9 @@ A test may, for instance, use the same value when selec= ting the architecture of a kernel or disk image to boot a VM with. =20 The ``arch`` attribute will be set to the test parameter of the same -name, and if one is not given explicitly, it will be set to ``None``. +name. If one is not given explicitly, it will either be set to +``None``, or, if the test is tagged with one (and only one) +``:avocado: tags=3Darch:VALUE`` tag, it will be set to ``VALUE``. =20 qemu_bin ~~~~~~~~ diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 688a0746a2..2b236a1cf0 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -53,7 +53,12 @@ def pick_default_qemu_bin(arch=3DNone): class Test(avocado.Test): def setUp(self): self._vms =3D {} - self.arch =3D self.params.get('arch') + arches =3D self.tags.get('arch', []) + if len(arches) =3D=3D 1: + arch =3D arches.pop() + else: + arch =3D None + self.arch =3D self.params.get('arch', default=3Darch) default_qemu_bin =3D pick_default_qemu_bin(arch=3Dself.arch) self.qemu_bin =3D self.params.get('qemu_bin', default=3Ddefault_qemu_bin) --=20 2.20.1