From nobody Sun May 5 14:59:43 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1569354550; cv=none; d=zoho.com; s=zohoarc; b=bQ9K/rN6doY6h7a1xcOpFTecd74rmPBupuSOTxgikjc9MFEXvj08tysnXRu2QOoCt2QAG9y1YsRh8kUAuOB4kjlPKnHpE0ABbguTEXUOyxVvm2P1PSAwSSbDGpPDB4V7NBvGPVQtaLmrT3Ak0dtKYU834h9MmYrbsoYExtIjxlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569354550; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=majUesMRRCV2zOyl9sLgQ7M4qJFjCnbF88fJIJIQdtE=; b=VnyS9DZG4ZjxGY5ztZ/DDhqnb+pj4IqG/lvX62TWbpALYuy1Nmvkqk5iSfHP0N6gK4wA1v8T4r9avoPqDEvuhPm3TOSpFJDVLLIFUiG+BOiszZyGB2uMHE+azGtMVZtafGuJlCZcTWbZ9rl9/aujWsdbRyFKspTYMs3VmKuO4kg= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569354550251834.1537419767543; Tue, 24 Sep 2019 12:49:10 -0700 (PDT) Received: from localhost ([::1]:50256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCqo5-00075y-EF for importer@patchew.org; Tue, 24 Sep 2019 15:49:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35020) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCqkU-0005CC-Al for qemu-devel@nongnu.org; Tue, 24 Sep 2019 15:45:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCqkS-0004S2-Rz for qemu-devel@nongnu.org; Tue, 24 Sep 2019 15:45:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55440) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iCqkS-0004Qq-HA for qemu-devel@nongnu.org; Tue, 24 Sep 2019 15:45:20 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 805C7300CB28; Tue, 24 Sep 2019 19:45:19 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-121-0.rdu2.redhat.com [10.10.121.0]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B87061F24; Tue, 24 Sep 2019 19:45:13 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH 1/3] Acceptance test x86_cpu_model_versions: use default vm Date: Tue, 24 Sep 2019 15:44:59 -0400 Message-Id: <20190924194501.9303-2-crosa@redhat.com> In-Reply-To: <20190924194501.9303-1-crosa@redhat.com> References: <20190924194501.9303-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 24 Sep 2019 19:45:19 +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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Aleksandar Rikalo , Wainer dos Santos Moschetta , Willian Rampazzo , 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" The default vm provided by the test, available as self.vm, serves the same purpose of the one obtained by self.get_vm(), but saves a line and matches the style of other tests. Signed-off-by: Cleber Rosa --- tests/acceptance/x86_cpu_model_versions.py | 100 ++++++++++----------- 1 file changed, 46 insertions(+), 54 deletions(-) diff --git a/tests/acceptance/x86_cpu_model_versions.py b/tests/acceptance/= x86_cpu_model_versions.py index 5fc9ca4bc6..6eb977954d 100644 --- a/tests/acceptance/x86_cpu_model_versions.py +++ b/tests/acceptance/x86_cpu_model_versions.py @@ -25,10 +25,6 @@ import avocado_qemu import re =20 -def get_cpu_prop(vm, prop): - cpu_path =3D vm.command('query-cpus')[0].get('qom_path') - return vm.command('qom-get', path=3Dcpu_path, property=3Dprop) - class X86CPUModelAliases(avocado_qemu.Test): """ Validation of PC CPU model versions and CPU model aliases @@ -241,78 +237,74 @@ class CascadelakeArchCapabilities(avocado_qemu.Test): =20 :avocado: tags=3Darch:x86_64 """ + def get_cpu_prop(self, prop): + cpu_path =3D self.vm.command('query-cpus')[0].get('qom_path') + return self.vm.command('qom-get', path=3Dcpu_path, property=3Dprop) + def test_4_1(self): # machine-type only: - vm =3D self.get_vm() - vm.add_args('-S') - vm.set_machine('pc-i440fx-4.1') - vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff') - vm.launch() - self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.1') + self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don= ,check=3Doff,enforce=3Doff') + self.vm.launch() + self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server should not ha= ve arch-capabilities') =20 def test_4_0(self): - vm =3D self.get_vm() - vm.add_args('-S') - vm.set_machine('pc-i440fx-4.0') - vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff') - vm.launch() - self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.0') + self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don= ,check=3Doff,enforce=3Doff') + self.vm.launch() + self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server should not ha= ve arch-capabilities') =20 def test_set_4_0(self): # command line must override machine-type if CPU model is not vers= ioned: - vm =3D self.get_vm() - vm.add_args('-S') - vm.set_machine('pc-i440fx-4.0') - vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff,+arch-capabilities') - vm.launch() - self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.0') + self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don= ,check=3Doff,enforce=3Doff,+arch-capabilities') + self.vm.launch() + self.assertTrue(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server,+arch-capabili= ties should have arch-capabilities') =20 def test_unset_4_1(self): - vm =3D self.get_vm() - vm.add_args('-S') - vm.set_machine('pc-i440fx-4.1') - vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff,-arch-capabilities') - vm.launch() - self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.1') + self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don= ,check=3Doff,enforce=3Doff,-arch-capabilities') + self.vm.launch() + self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server,-arch-capabil= ities should not have arch-capabilities') =20 def test_v1_4_0(self): # versioned CPU model overrides machine-type: - vm =3D self.get_vm() - vm.add_args('-S') - vm.set_machine('pc-i440fx-4.0') - vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features=3Don,c= heck=3Doff,enforce=3Doff') - vm.launch() - self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.0') + self.vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features= =3Don,check=3Doff,enforce=3Doff') + self.vm.launch() + self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server-v1 should not= have arch-capabilities') =20 def test_v2_4_0(self): - vm =3D self.get_vm() - vm.add_args('-S') - vm.set_machine('pc-i440fx-4.0') - vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features=3Don,c= heck=3Doff,enforce=3Doff') - vm.launch() - self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), - 'pc-i440fx-4.0 + Cascadelake-Server-v2 should hav= e arch-capabilities') + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.0') + self.vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features= =3Don,check=3Doff,enforce=3Doff') + self.vm.launch() + self.assertTrue(self.get_cpu_prop('arch-capabilities'), + 'pc-i440fx-4.0 + Cascadelake-Server-v2 should have= arch-capabilities') =20 def test_v1_set_4_0(self): # command line must override machine-type and versioned CPU model: - vm =3D self.get_vm() - vm.add_args('-S') - vm.set_machine('pc-i440fx-4.0') - vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features=3Don,c= heck=3Doff,enforce=3Doff,+arch-capabilities') - vm.launch() - self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), - 'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capa= bilities should have arch-capabilities') + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.0') + self.vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features= =3Don,check=3Doff,enforce=3Doff,+arch-capabilities') + self.vm.launch() + self.assertTrue(self.get_cpu_prop('arch-capabilities'), + 'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capab= ilities should have arch-capabilities') =20 def test_v2_unset_4_1(self): - vm =3D self.get_vm() - vm.add_args('-S') - vm.set_machine('pc-i440fx-4.1') - vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features=3Don,c= heck=3Doff,enforce=3Doff,-arch-capabilities') - vm.launch() - self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.1') + self.vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features= =3Don,check=3Doff,enforce=3Doff,-arch-capabilities') + self.vm.launch() + self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server-v2,-arch-capa= bilities should not have arch-capabilities') --=20 2.21.0 From nobody Sun May 5 14:59:43 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1569354775; cv=none; d=zoho.com; s=zohoarc; b=lV+cDB3GSGnrKQ9L9STIDcBlXLaGSQWTr82JWGlq3r60K7623I9OzNxH/jPVW5tL4cJzwHA3t0tEihTK8+SyytAZZAQZLMeRu2rOdMTM/F6KHETLj4EHZ2AGL9mt6rJZWi1gWcuqZFG/Lm9zeUFo3AhwH3z4EPayl9ph7+IBoWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569354775; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Y8iK8q7K+IcIKcpaL5RGdewy52S2DnzCir6bXQcO3X4=; b=Zk5on0CXLvrY2+t1HsOlAZcq96gd9M1XuZfFquL/WIqhbmDhUv2ZDrLLK62AGAY75I2wbEcqsI58zpNuB/++OasyjU20Bsv7qnig2Z6JhvghdAkC6t5EZExof+N8pOA+gkpA99bhJKXuved5atguRBQ4IK0lKbk7iEWga42wouc= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569354775516116.65078395891919; Tue, 24 Sep 2019 12:52:55 -0700 (PDT) Received: from localhost ([::1]:50318 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCqrk-0002UB-59 for importer@patchew.org; Tue, 24 Sep 2019 15:52:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35030) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCqkV-0005D9-DD for qemu-devel@nongnu.org; Tue, 24 Sep 2019 15:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCqkU-0004TL-5c for qemu-devel@nongnu.org; Tue, 24 Sep 2019 15:45:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34008) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iCqkT-0004SS-V7 for qemu-devel@nongnu.org; Tue, 24 Sep 2019 15:45:22 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1A44859FB; Tue, 24 Sep 2019 19:45:20 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-121-0.rdu2.redhat.com [10.10.121.0]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE85761F21; Tue, 24 Sep 2019 19:45:19 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH 2/3] Acceptance tests: introduce utility method for tags unique vals Date: Tue, 24 Sep 2019 15:45:00 -0400 Message-Id: <20190924194501.9303-3-crosa@redhat.com> In-Reply-To: <20190924194501.9303-1-crosa@redhat.com> References: <20190924194501.9303-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 24 Sep 2019 19:45: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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Aleksandar Rikalo , Wainer dos Santos Moschetta , Willian Rampazzo , 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" Currently a test can describe the target architecture binary that it should primarily be run with, be setting a single tag value. The same approach is expected to be done with other QEMU aspects to be tested, for instance, the machine type and accelerator, so let's generalize the logic into a utility method. Signed-off-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta --- tests/acceptance/avocado_qemu/__init__.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index bd41e0443c..02775bafcf 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -54,14 +54,21 @@ def pick_default_qemu_bin(arch=3DNone): =20 =20 class Test(avocado.Test): + def _get_unique_tag_val(self, tag_name): + """ + Gets a tag value, if unique for a key + """ + vals =3D self.tags.get(tag_name, []) + if len(vals) =3D=3D 1: + return vals.pop() + return None + def setUp(self): self._vms =3D {} - 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) + + self.arch =3D self.params.get('arch', + default=3Dself._get_unique_tag_val('ar= ch')) + 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.21.0 From nobody Sun May 5 14:59:43 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1569354774; cv=none; d=zoho.com; s=zohoarc; b=lBshPLwStxPFE00M7aJduqRPgr2NJgOg03yc9UtksqhyAKQxHkmxAsAVAiJCE8SP9cMl6jS9/oec7TQ6oZo93ni3CrOKCjqwE5CSjfwPSlESajM2lOh2FV6WL6ci74ftxO+4qJzFT4mKs8sJx12vGoW+9Yhj+nAby7KoBbgpA+g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569354774; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=kXadheEOvBHkn+yD0AvxkrJCfjLw7W0/Os5ZM0UrRhk=; b=WzJP1R2YALTeS9ZgbpU1GPICoG+wrGVwL/8jud/iOi/MSEN9srld9ieuUNZ3GseCdv64venaMoE9DIGnn7NZPgBuVdqRcTbJ3pGIPhpFdVvIYz8bDkTwGSQLnXuF6z8XeR5WYTatTtzB8Abi11BJ/03a7gapbF+XcW5rJTRaTyc= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1569354774754780.7970810406856; Tue, 24 Sep 2019 12:52:54 -0700 (PDT) Received: from localhost ([::1]:50314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCqrh-0002ML-CR for importer@patchew.org; Tue, 24 Sep 2019 15:52:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35062) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCqkY-0005GF-Ok for qemu-devel@nongnu.org; Tue, 24 Sep 2019 15:45:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCqkV-0004Xm-O6 for qemu-devel@nongnu.org; Tue, 24 Sep 2019 15:45:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17330) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iCqkV-0004UA-BN for qemu-devel@nongnu.org; Tue, 24 Sep 2019 15:45:23 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41B218980FB; Tue, 24 Sep 2019 19:45:22 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-121-0.rdu2.redhat.com [10.10.121.0]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 087B461F21; Tue, 24 Sep 2019 19:45:20 +0000 (UTC) From: Cleber Rosa To: qemu-devel@nongnu.org Subject: [PATCH 3/3] Acceptance Tests: use avocado tags for machine type Date: Tue, 24 Sep 2019 15:45:01 -0400 Message-Id: <20190924194501.9303-4-crosa@redhat.com> In-Reply-To: <20190924194501.9303-1-crosa@redhat.com> References: <20190924194501.9303-1-crosa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Tue, 24 Sep 2019 19:45:22 +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 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Aleksandar Rikalo , Wainer dos Santos Moschetta , Willian Rampazzo , 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" The same way the arch tag is being used as a fallback for the arch parameter, let's do the same for QEMU's machine and avoid some boiler plate code. This requires a bump in the Avocado version, as starting with 72.0, the characters supported in tags are less strict. Signed-off-by: Cleber Rosa Reviewed-by: Wainer dos Santos Moschetta --- docs/devel/testing.rst | 18 ++++++++ tests/acceptance/avocado_qemu/__init__.py | 5 ++ tests/acceptance/boot_linux_console.py | 15 +----- tests/acceptance/cpu_queries.py | 2 +- tests/acceptance/linux_initrd.py | 2 +- tests/acceptance/linux_ssh_mips_malta.py | 5 -- tests/acceptance/machine_m68k_nextcube.py | 21 ++------- tests/acceptance/x86_cpu_model_versions.py | 53 ++++++++++++++++------ 8 files changed, 71 insertions(+), 50 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index bf75675fb0..1816ada919 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -744,6 +744,17 @@ 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 +machine +~~~~~~~ + +The machine type that will be set to all QEMUMachine instances created +by the test. + +The ``machine`` attribute will be set to the test parameter of the same +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=3Dmachine:VALUE`` tag, it will be set to ``VALUE``. + qemu_bin ~~~~~~~~ =20 @@ -779,6 +790,13 @@ architecture of a kernel or disk image to boot a VM wi= th. This parameter has a direct relation with the ``arch`` attribute. If not given, it will default to None. =20 +machine +~~~~~~~ + +The machine type that will be set to all QEMUMachine instances created +by the test. + + qemu_bin ~~~~~~~~ =20 diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/a= vocado_qemu/__init__.py index 02775bafcf..fb5d6616bc 100644 --- a/tests/acceptance/avocado_qemu/__init__.py +++ b/tests/acceptance/avocado_qemu/__init__.py @@ -69,6 +69,9 @@ class Test(avocado.Test): self.arch =3D self.params.get('arch', default=3Dself._get_unique_tag_val('ar= ch')) =20 + self.machine =3D self.params.get('machine', + default=3Dself._get_unique_tag_val(= 'machine')) + default_qemu_bin =3D pick_default_qemu_bin(arch=3Dself.arch) self.qemu_bin =3D self.params.get('qemu_bin', default=3Ddefault_qemu_bin) @@ -90,6 +93,8 @@ class Test(avocado.Test): name =3D str(uuid.uuid4()) if self._vms.get(name) is None: self._vms[name] =3D self._new_vm(*args) + if self.machine is not None: + self._vms[name].set_machine(self.machine) return self._vms[name] =20 def tearDown(self): diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot= _linux_console.py index 8a9a314ab4..3d2a53d4c8 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -82,7 +82,6 @@ class BootLinuxConsole(Test): kernel_hash =3D '23bebd2680757891cf7adedb033532163a792495' kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) =20 - self.vm.set_machine('pc') self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3DttyS0' self.vm.add_args('-kernel', kernel_path, @@ -105,7 +104,6 @@ class BootLinuxConsole(Test): kernel_path =3D self.extract_from_deb(deb_path, '/boot/vmlinux-2.6.32-5-4kc-ma= lta') =20 - self.vm.set_machine('malta') self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3DttyS0' self.vm.add_args('-kernel', kernel_path, @@ -138,7 +136,6 @@ class BootLinuxConsole(Test): kernel_path =3D self.extract_from_deb(deb_path, '/boot/vmlinux-2.6.32-5-5kc-ma= lta') =20 - self.vm.set_machine('malta') self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3DttyS0' self.vm.add_args('-kernel', kernel_path, @@ -171,7 +168,6 @@ class BootLinuxConsole(Test): with open(initrd_path, 'wb') as f_out: shutil.copyfileobj(f_in, f_out) =20 - self.vm.set_machine('malta') self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + 'console=3DttyS0 console=3Dtty ' @@ -197,7 +193,6 @@ class BootLinuxConsole(Test): with open(kernel_path, 'wb') as f_out: shutil.copyfileobj(f_in, f_out) =20 - self.vm.set_machine('malta') self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + 'mem=3D256m@@0x0 ' @@ -257,7 +252,6 @@ class BootLinuxConsole(Test): kernel_hash =3D '8c73e469fc6ea06a58dc83a628fc695b693b8493' kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) =20 - self.vm.set_machine('virt') self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + 'console=3DttyAMA0') @@ -279,7 +273,6 @@ class BootLinuxConsole(Test): kernel_hash =3D 'e9826d741b4fb04cadba8d4824d1ed3b7fb8b4d4' kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) =20 - self.vm.set_machine('virt') self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + 'console=3DttyAMA0') @@ -292,7 +285,7 @@ class BootLinuxConsole(Test): def test_arm_emcraft_sf2(self): """ :avocado: tags=3Darch:arm - :avocado: tags=3Dmachine:emcraft_sf2 + :avocado: tags=3Dmachine:emcraft-sf2 :avocado: tags=3Dendian:little """ uboot_url =3D ('https://raw.githubusercontent.com/' @@ -306,7 +299,6 @@ class BootLinuxConsole(Test): spi_hash =3D '85f698329d38de63aea6e884a86fbde70890a78a' spi_path =3D self.fetch_asset(spi_url, asset_hash=3Dspi_hash) =20 - self.vm.set_machine('emcraft-sf2') self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE self.vm.add_args('-kernel', uboot_path, @@ -319,7 +311,7 @@ class BootLinuxConsole(Test): def test_s390x_s390_ccw_virtio(self): """ :avocado: tags=3Darch:s390x - :avocado: tags=3Dmachine:s390_ccw_virtio + :avocado: tags=3Dmachine:s390-ccw-virtio """ kernel_url =3D ('https://archives.fedoraproject.org/pub/archive' '/fedora-secondary/releases/29/Everything/s390x/os/i= mages' @@ -327,7 +319,6 @@ class BootLinuxConsole(Test): kernel_hash =3D 'e8e8439103ef8053418ef062644ffd46a7919313' kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) =20 - self.vm.set_machine('s390-ccw-virtio') self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3Dsclp0' self.vm.add_args('-nodefaults', @@ -349,7 +340,6 @@ class BootLinuxConsole(Test): =20 uncompressed_kernel =3D archive.uncompress(kernel_path, self.workd= ir) =20 - self.vm.set_machine('clipper') self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3DttyS0' self.vm.add_args('-vga', 'std', @@ -370,7 +360,6 @@ class BootLinuxConsole(Test): kernel_hash =3D '3fe04abfc852b66653b8c3c897a59a689270bc77' kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) =20 - self.vm.set_machine('pseries') self.vm.set_console() kernel_command_line =3D self.KERNEL_COMMON_COMMAND_LINE + 'console= =3Dhvc0' self.vm.add_args('-kernel', kernel_path, diff --git a/tests/acceptance/cpu_queries.py b/tests/acceptance/cpu_queries= .py index af47d2795a..293dccb89a 100644 --- a/tests/acceptance/cpu_queries.py +++ b/tests/acceptance/cpu_queries.py @@ -20,8 +20,8 @@ class QueryCPUModelExpansion(Test): def test(self): """ :avocado: tags=3Darch:x86_64 + :avocado: tags=3Dmachine:none """ - self.vm.set_machine('none') self.vm.add_args('-S') self.vm.launch() =20 diff --git a/tests/acceptance/linux_initrd.py b/tests/acceptance/linux_init= rd.py index c61d9826a4..3a0ff7b098 100644 --- a/tests/acceptance/linux_initrd.py +++ b/tests/acceptance/linux_initrd.py @@ -20,6 +20,7 @@ class LinuxInitrd(Test): Checks QEMU evaluates correctly the initrd file passed as -initrd opti= on. =20 :avocado: tags=3Darch:x86_64 + :avocado: tags=3Dmachine:pc """ =20 timeout =3D 300 @@ -66,7 +67,6 @@ class LinuxInitrd(Test): initrd.write(b'\0') initrd.flush() =20 - self.vm.set_machine('pc') self.vm.set_console() kernel_command_line =3D 'console=3DttyS0' self.vm.add_args('-kernel', kernel_path, diff --git a/tests/acceptance/linux_ssh_mips_malta.py b/tests/acceptance/li= nux_ssh_mips_malta.py index 25a1df5098..e40a57de51 100644 --- a/tests/acceptance/linux_ssh_mips_malta.py +++ b/tests/acceptance/linux_ssh_mips_malta.py @@ -95,7 +95,6 @@ class LinuxSSH(Test): image_hash =3D self.IMAGE_INFO[endianess]['image_hash'] image_path =3D self.fetch_asset(image_url, asset_hash=3Dimage_hash) =20 - self.vm.set_machine('malta') self.vm.set_console() kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + 'console=3DttyS0 root=3D/dev/sda1') @@ -199,7 +198,6 @@ class LinuxSSH(Test): def test_mips_malta32eb_kernel3_2_0(self): """ :avocado: tags=3Darch:mips - :avocado: tags=3Dmachine:malta :avocado: tags=3Dendian:big :avocado: tags=3Ddevice:pcnet32 """ @@ -213,7 +211,6 @@ class LinuxSSH(Test): def test_mips_malta32el_kernel3_2_0(self): """ :avocado: tags=3Darch:mipsel - :avocado: tags=3Dmachine:malta :avocado: tags=3Dendian:little :avocado: tags=3Ddevice:pcnet32 """ @@ -227,7 +224,6 @@ class LinuxSSH(Test): def test_mips_malta64eb_kernel3_2_0(self): """ :avocado: tags=3Darch:mips64 - :avocado: tags=3Dmachine:malta :avocado: tags=3Dendian:big :avocado: tags=3Ddevice:pcnet32 """ @@ -240,7 +236,6 @@ class LinuxSSH(Test): def test_mips_malta64el_kernel3_2_0(self): """ :avocado: tags=3Darch:mips64el - :avocado: tags=3Dmachine:malta :avocado: tags=3Dendian:little :avocado: tags=3Ddevice:pcnet32 """ diff --git a/tests/acceptance/machine_m68k_nextcube.py b/tests/acceptance/m= achine_m68k_nextcube.py index fcd2c58ee7..32cf571f94 100644 --- a/tests/acceptance/machine_m68k_nextcube.py +++ b/tests/acceptance/machine_m68k_nextcube.py @@ -43,6 +43,11 @@ def tesseract_available(expected_version): =20 =20 class NextCubeMachine(Test): + """ + :avocado: tags=3Darch:m68k + :avocado: tags=3Dmachine:next-cube + :avocado: tags=3Ddevice:framebuffer + """ =20 timeout =3D 15 =20 @@ -52,7 +57,6 @@ class NextCubeMachine(Test): rom_hash =3D 'b3534796abae238a0111299fc406a9349f7fee24' rom_path =3D self.fetch_asset(rom_url, asset_hash=3Drom_hash) =20 - self.vm.set_machine('next-cube') self.vm.add_args('-bios', rom_path) self.vm.launch() =20 @@ -66,11 +70,6 @@ class NextCubeMachine(Test): =20 @skipUnless(PIL_AVAILABLE, 'Python PIL not installed') def test_bootrom_framebuffer_size(self): - """ - :avocado: tags=3Darch:m68k - :avocado: tags=3Dmachine:next_cube - :avocado: tags=3Ddevice:framebuffer - """ screenshot_path =3D os.path.join(self.workdir, "dump.png") self.check_bootrom_framebuffer(screenshot_path) =20 @@ -80,11 +79,6 @@ class NextCubeMachine(Test): =20 @skipUnless(tesseract_available(3), 'tesseract v3 OCR tool not availab= le') def test_bootrom_framebuffer_ocr_with_tesseract_v3(self): - """ - :avocado: tags=3Darch:m68k - :avocado: tags=3Dmachine:next_cube - :avocado: tags=3Ddevice:framebuffer - """ screenshot_path =3D os.path.join(self.workdir, "dump.png") self.check_bootrom_framebuffer(screenshot_path) =20 @@ -101,11 +95,6 @@ class NextCubeMachine(Test): # that it is still alpha-level software. @skipUnless(tesseract_available(4), 'tesseract v4 OCR tool not availab= le') def test_bootrom_framebuffer_ocr_with_tesseract_v4(self): - """ - :avocado: tags=3Darch:m68k - :avocado: tags=3Dmachine:next_cube - :avocado: tags=3Ddevice:framebuffer - """ screenshot_path =3D os.path.join(self.workdir, "dump.png") self.check_bootrom_framebuffer(screenshot_path) =20 diff --git a/tests/acceptance/x86_cpu_model_versions.py b/tests/acceptance/= x86_cpu_model_versions.py index 6eb977954d..90558d9a71 100644 --- a/tests/acceptance/x86_cpu_model_versions.py +++ b/tests/acceptance/x86_cpu_model_versions.py @@ -75,12 +75,15 @@ class X86CPUModelAliases(avocado_qemu.Test): "EPYC-IBPB shouldn't be versioned") =20 def test_4_0_alias_compatibility(self): - """Check if pc-*-4.0 unversioned CPU model won't be reported as al= iases""" + """ + Check if pc-*-4.0 unversioned CPU model won't be reported as alias= es + + :avocado: tags=3Dmachine:pc-i440fx-4.0 + """ # pc-*-4.0 won't expose non-versioned CPU models as aliases # We do this to help management software to keep compatibility # with older QEMU versions that didn't have the versioned CPU model self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.0') self.vm.launch() cpus =3D dict((m['name'], m) for m in self.vm.command('query-cpu-d= efinitions')) =20 @@ -105,9 +108,12 @@ class X86CPUModelAliases(avocado_qemu.Test): self.assertNotIn('alias-of', c, "%s shouldn't be an alias" % (= name)) =20 def test_4_1_alias(self): - """Check if unversioned CPU model is an alias pointing to right ve= rsion""" + """ + Check if unversioned CPU model is an alias pointing to right versi= on + + :avocado: tags=3Dmachine:pc-i440fx-4.1 + """ self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.1') self.vm.launch() =20 cpus =3D dict((m['name'], m) for m in self.vm.command('query-cpu-d= efinitions')) @@ -207,9 +213,12 @@ class X86CPUModelAliases(avocado_qemu.Test): self.validate_aliases(cpus) =20 def test_none_alias(self): - """Check if unversioned CPU model is an alias pointing to some ver= sion""" + """ + Check if unversioned CPU model is an alias pointing to some version + + :avocado: tags=3Dmachine:none + """ self.vm.add_args('-S') - self.vm.set_machine('none') self.vm.launch() =20 cpus =3D dict((m['name'], m) for m in self.vm.command('query-cpu-d= efinitions')) @@ -242,68 +251,84 @@ class CascadelakeArchCapabilities(avocado_qemu.Test): return self.vm.command('qom-get', path=3Dcpu_path, property=3Dprop) =20 def test_4_1(self): + """ + :avocado: tags=3Dmachine:pc-i440fx-4.1 + """ # machine-type only: self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.1') self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don= ,check=3Doff,enforce=3Doff') self.vm.launch() self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server should not ha= ve arch-capabilities') =20 def test_4_0(self): + """ + :avocado: tags=3Dmachine:pc-i440fx-4.0 + """ self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.0') self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don= ,check=3Doff,enforce=3Doff') self.vm.launch() self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server should not ha= ve arch-capabilities') =20 def test_set_4_0(self): + """ + :avocado: tags=3Dmachine:pc-i440fx-4.0 + """ # command line must override machine-type if CPU model is not vers= ioned: self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.0') self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don= ,check=3Doff,enforce=3Doff,+arch-capabilities') self.vm.launch() self.assertTrue(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server,+arch-capabili= ties should have arch-capabilities') =20 def test_unset_4_1(self): + """ + :avocado: tags=3Dmachine:pc-i440fx-4.1 + """ self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.1') self.vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don= ,check=3Doff,enforce=3Doff,-arch-capabilities') self.vm.launch() self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.1 + Cascadelake-Server,-arch-capabil= ities should not have arch-capabilities') =20 def test_v1_4_0(self): + """ + :avocado: tags=3Dmachine:pc-i440fx-4.0 + """ # versioned CPU model overrides machine-type: self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.0') self.vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features= =3Don,check=3Doff,enforce=3Doff') self.vm.launch() self.assertFalse(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server-v1 should not= have arch-capabilities') =20 def test_v2_4_0(self): + """ + :avocado: tags=3Dmachine:pc-i440fx-4.0 + """ self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.0') self.vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features= =3Don,check=3Doff,enforce=3Doff') self.vm.launch() self.assertTrue(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server-v2 should have= arch-capabilities') =20 def test_v1_set_4_0(self): + """ + :avocado: tags=3Dmachine:pc-i440fx-4.0 + """ # command line must override machine-type and versioned CPU model: self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.0') self.vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features= =3Don,check=3Doff,enforce=3Doff,+arch-capabilities') self.vm.launch() self.assertTrue(self.get_cpu_prop('arch-capabilities'), 'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capab= ilities should have arch-capabilities') =20 def test_v2_unset_4_1(self): + """ + :avocado: tags=3Dmachine:pc-i440fx-4.1 + """ self.vm.add_args('-S') - self.vm.set_machine('pc-i440fx-4.1') self.vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features= =3Don,check=3Doff,enforce=3Doff,-arch-capabilities') self.vm.launch() self.assertFalse(self.get_cpu_prop('arch-capabilities'), --=20 2.21.0