From nobody Sun Nov 24 10:32:27 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1725446874; cv=none; d=zohomail.com; s=zohoarc; b=VezLSvGCjCSLMP6fp5HbJVpdrt26aEBniblEWbZLfGLvYCARDbINv/8H2+rlSV64ZC9dw6LcHdo77hG0RG8DKTNnkSkT5DPrrzORm7ZthqwBpwjQbZq4lkyHQATCx+7X2x8SlWdx9tBnqdAyDA4Em+uTeCXGK5aopEI4jYASDuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725446874; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aBAqDxmEUSZjQMhhkls8Q7XxMobFcNea7ZH9z1PDF3Q=; b=YLUEOXzInMW7Tlhqmgqqf3s9cIPkb0o/vlo1KJBc3I5keDeevqjrLylFoQf6wmeRh15xwF6j0xVtIeH2aG/P42Jau2OVfl/rEMDVepxCvNucyHFmchs351O5mbWdyh0birh3bcegxtf5NZ+9RVJA1c5xXrlOKCqJUU5I7rfF+5Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725446874958679.4355203389397; Wed, 4 Sep 2024 03:47:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slnQr-00026T-T3; Wed, 04 Sep 2024 06:40:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1slnQq-000214-EE for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:40:12 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1slnQn-0000G0-Qj for qemu-devel@nongnu.org; Wed, 04 Sep 2024 06:40:12 -0400 Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-486-s8zakrmjODGWPtf4ICxDPw-1; Wed, 04 Sep 2024 06:40:05 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E01DD19560B5; Wed, 4 Sep 2024 10:40:04 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.194.48]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 5D7ED195605A; Wed, 4 Sep 2024 10:40:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725446409; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aBAqDxmEUSZjQMhhkls8Q7XxMobFcNea7ZH9z1PDF3Q=; b=APDrI8EHHYHhUl8YC14+oJC5l0J3aI9+Olr4wpG8WduARBH/5k0BehhOmPLskrwuzkXT5/ FobbX/5M6vWy81Igh52BRBLqATQhGo/EB0SBrgK8oU7ovZ3luTISOzrEUccwv7i3R+VzXn hx+egJzii2zfr3um1/sux5u4EnJ1hMU= X-MC-Unique: s8zakrmjODGWPtf4ICxDPw-1 From: Thomas Huth To: qemu-devel@nongnu.org Cc: Richard Henderson , Stefan Hajnoczi , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 12/42] tests/functional: Convert simple avocado tests into standalone python tests Date: Wed, 4 Sep 2024 12:38:47 +0200 Message-ID: <20240904103923.451847-13-thuth@redhat.com> In-Reply-To: <20240904103923.451847-1-thuth@redhat.com> References: <20240904103923.451847-1-thuth@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=170.10.133.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1725446876120116600 These test are rather simple and don't need any modifications apart from adjusting the "from avocado_qemu" line. To ease debugging, make the files executable and add a shebang line and Python '__main__' handling, too, so that these tests can now be run by executing them directly. Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 Message-ID: <20240830133841.142644-13-thuth@redhat.com> Signed-off-by: Thomas Huth --- MAINTAINERS | 5 ++ tests/functional/meson.build | 5 ++ .../test_cpu_queries.py} | 12 +++-- .../test_empty_cpu_model.py} | 7 ++- .../test_mem_addr_space.py} | 52 +++---------------- .../test_pc_cpu_hotplug_props.py} | 11 ++-- .../test_virtio_version.py} | 8 +-- 7 files changed, 40 insertions(+), 60 deletions(-) rename tests/{avocado/cpu_queries.py =3D> functional/test_cpu_queries.py} = (85%) mode change 100644 =3D> 100755 rename tests/{avocado/empty_cpu_model.py =3D> functional/test_empty_cpu_mo= del.py} (84%) mode change 100644 =3D> 100755 rename tests/{avocado/mem-addr-space-check.py =3D> functional/test_mem_add= r_space.py} (93%) mode change 100644 =3D> 100755 rename tests/{avocado/pc_cpu_hotplug_props.py =3D> functional/test_pc_cpu_= hotplug_props.py} (90%) mode change 100644 =3D> 100755 rename tests/{avocado/virtio_version.py =3D> functional/test_virtio_versio= n.py} (98%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 80cc84dd99..b3a0ac0e8b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1833,6 +1833,8 @@ F: hw/isa/apm.c F: include/hw/isa/apm.h F: tests/unit/test-x86-topo.c F: tests/qtest/test-x86-cpuid-compat.c +F: tests/functional/test_mem_addr_space.py +F: tests/functional/test_pc_cpu_hotplug_props.py =20 PC Chipset M: Michael S. Tsirkin @@ -1899,6 +1901,8 @@ F: include/hw/boards.h F: include/hw/core/cpu.h F: include/hw/cpu/cluster.h F: include/sysemu/numa.h +F: tests/functional/test_cpu_queries.py +F: tests/functional/test_empty_cpu_model.py F: tests/unit/test-smp-parse.c T: git https://gitlab.com/ehabkost/qemu.git machine-next =20 @@ -2238,6 +2242,7 @@ F: net/vhost-user.c F: include/hw/virtio/ F: docs/devel/virtio* F: docs/devel/migration/virtio.rst +F: tests/functional/test_virtio_version.py =20 virtio-balloon M: Michael S. Tsirkin diff --git a/tests/functional/meson.build b/tests/functional/meson.build index 052d2e8781..91201a2e26 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -14,6 +14,7 @@ test_timeouts =3D { } =20 tests_generic_system =3D [ + 'empty_cpu_model', ] =20 tests_generic_linuxuser =3D [ @@ -23,6 +24,10 @@ tests_generic_bsduser =3D [ ] =20 tests_x86_64_system_quick =3D [ + 'cpu_queries', + 'mem_addr_space', + 'pc_cpu_hotplug_props', + 'virtio_version', ] =20 tests_x86_64_system_thorough =3D [ diff --git a/tests/avocado/cpu_queries.py b/tests/functional/test_cpu_queri= es.py old mode 100644 new mode 100755 similarity index 85% rename from tests/avocado/cpu_queries.py rename to tests/functional/test_cpu_queries.py index d3faa14720..b1122a0e8f --- a/tests/avocado/cpu_queries.py +++ b/tests/functional/test_cpu_queries.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Sanity check of query-cpu-* results # # Copyright (c) 2019 Red Hat, Inc. @@ -8,7 +10,7 @@ # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 class QueryCPUModelExpansion(QemuSystemTest): """ @@ -16,10 +18,7 @@ class QueryCPUModelExpansion(QemuSystemTest): """ =20 def test(self): - """ - :avocado: tags=3Darch:x86_64 - :avocado: tags=3Dmachine:none - """ + self.set_machine('none') self.vm.add_args('-S') self.vm.launch() =20 @@ -33,3 +32,6 @@ def test(self): e =3D self.vm.cmd('query-cpu-model-expansion', model=3Dmodel, type=3D'full') self.assertEqual(e['model']['name'], c['name']) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/empty_cpu_model.py b/tests/functional/test_empty= _cpu_model.py old mode 100644 new mode 100755 similarity index 84% rename from tests/avocado/empty_cpu_model.py rename to tests/functional/test_empty_cpu_model.py index d906ef3d3c..0081b06d85 --- a/tests/avocado/empty_cpu_model.py +++ b/tests/functional/test_empty_cpu_model.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Check for crash when using empty -cpu option # # Copyright (c) 2019 Red Hat, Inc. @@ -7,7 +9,7 @@ # # This work is licensed under the terms of the GNU GPL, version 2 or # later. See the COPYING file in the top-level directory. -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 class EmptyCPUModel(QemuSystemTest): def test(self): @@ -17,3 +19,6 @@ def test(self): self.vm.wait() self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be = 1") self.assertRegex(self.vm.get_log(), r'-cpu option cannot be empty') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/mem-addr-space-check.py b/tests/functional/test_= mem_addr_space.py old mode 100644 new mode 100755 similarity index 93% rename from tests/avocado/mem-addr-space-check.py rename to tests/functional/test_mem_addr_space.py index d3974599f4..bb0cf062ca --- a/tests/avocado/mem-addr-space-check.py +++ b/tests/functional/test_mem_addr_space.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Check for crash when using memory beyond the available guest processor # address space. # @@ -8,7 +10,7 @@ # # SPDX-License-Identifier: GPL-2.0-or-later =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest import time =20 class MemAddrCheck(QemuSystemTest): @@ -22,9 +24,6 @@ class MemAddrCheck(QemuSystemTest): # for all 32-bit cases, pci64_hole_size is 0. def test_phybits_low_pse36(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - With pse36 feature ON, a processor has 36 bits of addressing. So i= t can access up to a maximum of 64GiB of memory. Memory hotplug region b= egins at 4 GiB boundary when "above_4g_mem_size" is 0 (this would be tru= e when @@ -52,9 +51,6 @@ def test_phybits_low_pse36(self): =20 def test_phybits_low_pae(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - With pae feature ON, a processor has 36 bits of addressing. So it = can access up to a maximum of 64GiB of memory. Rest is the same as the= case with pse36 above. @@ -72,9 +68,6 @@ def test_phybits_low_pae(self): =20 def test_phybits_ok_pentium_pse36(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Setting maxmem to 59.5G and making sure that QEMU can start with t= he same options as the failing case above with pse36 cpu feature. """ @@ -91,9 +84,6 @@ def test_phybits_ok_pentium_pse36(self): =20 def test_phybits_ok_pentium_pae(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Test is same as above but now with pae cpu feature turned on. Setting maxmem to 59.5G and making sure that QEMU can start fine with the same options as the case above. @@ -111,9 +101,6 @@ def test_phybits_ok_pentium_pae(self): =20 def test_phybits_ok_pentium2(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Pentium2 has 36 bits of addressing, so its same as pentium with pse36 ON. """ @@ -130,9 +117,6 @@ def test_phybits_ok_pentium2(self): =20 def test_phybits_low_nonpse36(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Pentium processor has 32 bits of addressing without pse36 or pae so it can access physical address up to 4 GiB. Setting maxmem to 4 GiB should make QEMU fail to start with "phys-bits too low" @@ -153,9 +137,6 @@ def test_phybits_low_nonpse36(self): # now lets test some 64-bit CPU cases. def test_phybits_low_tcg_q35_70_amd(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - For q35 7.1 machines and above, there is a HT window that starts at 1024 GiB and ends at 1 TiB - 1. If the max GPA falls in this range, "above_4G" memory is adjusted to start at 1 TiB boundary for AMD c= pus @@ -182,9 +163,6 @@ def test_phybits_low_tcg_q35_70_amd(self): =20 def test_phybits_low_tcg_q35_71_amd(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - AMD_HT_START is defined to be at 1012 GiB. So for q35 machines version > 7.0 and AMD cpus, instead of 1024 GiB limit for 40 bit processor address space, it has to be 1012 GiB , that is 12 GiB @@ -205,9 +183,6 @@ def test_phybits_low_tcg_q35_71_amd(self): =20 def test_phybits_ok_tcg_q35_70_amd(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Same as q35-7.0 AMD case except that here we check that QEMU can successfully start when maxmem is < 988G. """ @@ -224,9 +199,6 @@ def test_phybits_ok_tcg_q35_70_amd(self): =20 def test_phybits_ok_tcg_q35_71_amd(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Same as q35-7.1 AMD case except that here we check that QEMU can successfully start when maxmem is < 976G. """ @@ -243,9 +215,6 @@ def test_phybits_ok_tcg_q35_71_amd(self): =20 def test_phybits_ok_tcg_q35_71_intel(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Same parameters as test_phybits_low_tcg_q35_71_amd() but use Intel cpu instead. QEMU should start fine in this case as "above_4G" memory starts at 4G. @@ -264,9 +233,6 @@ def test_phybits_ok_tcg_q35_71_intel(self): =20 def test_phybits_low_tcg_q35_71_amd_41bits(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - AMD processor with 41 bits. Max cpu hw address =3D 2 TiB. By setting maxram above 1012 GiB - 32 GiB - 4 GiB =3D 976 GiB, we= can force "above_4G" memory to start at 1 TiB for q35-7.1 machines @@ -291,9 +257,6 @@ def test_phybits_low_tcg_q35_71_amd_41bits(self): =20 def test_phybits_ok_tcg_q35_71_amd_41bits(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - AMD processor with 41 bits. Max cpu hw address =3D 2 TiB. Same as above but by setting maxram between 976 GiB and 992 Gib, QEMU should start fine. @@ -312,9 +275,6 @@ def test_phybits_ok_tcg_q35_71_amd_41bits(self): =20 def test_phybits_low_tcg_q35_intel_cxl(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - cxl memory window starts after memory device range. Here, we use 1= GiB of cxl window memory. 4G_mem end aligns at 4G. pci64_hole is 32 Gi= B and starts after the cxl memory window. @@ -335,9 +295,6 @@ def test_phybits_low_tcg_q35_intel_cxl(self): =20 def test_phybits_ok_tcg_q35_intel_cxl(self): """ - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Darch:x86_64 - Same as above but here we do not reserve any cxl memory window. He= nce, with the exact same parameters as above, QEMU should start fine ev= en with cxl enabled. @@ -352,3 +309,6 @@ def test_phybits_ok_tcg_q35_intel_cxl(self): time.sleep(self.DELAY_Q35_BOOT_SEQUENCE) self.vm.shutdown() self.assertNotRegex(self.vm.get_log(), r'phys-bits too low') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/pc_cpu_hotplug_props.py b/tests/functional/test_= pc_cpu_hotplug_props.py old mode 100644 new mode 100755 similarity index 90% rename from tests/avocado/pc_cpu_hotplug_props.py rename to tests/functional/test_pc_cpu_hotplug_props.py index 4bd3e02665..9d5a37cb17 --- a/tests/avocado/pc_cpu_hotplug_props.py +++ b/tests/functional/test_pc_cpu_hotplug_props.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 # # Ensure CPU die-id can be omitted on -device # @@ -20,16 +21,16 @@ # License along with this library; if not, see . # =20 -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 class OmittedCPUProps(QemuSystemTest): - """ - :avocado: tags=3Darch:x86_64 - :avocado: tags=3Dcpu:qemu64 - """ + def test_no_die_id(self): self.vm.add_args('-nodefaults', '-S') self.vm.add_args('-smp', '1,sockets=3D2,cores=3D2,threads=3D2,maxc= pus=3D8') self.vm.add_args('-device', 'qemu64-x86_64-cpu,socket-id=3D1,core-= id=3D0,thread-id=3D0') self.vm.launch() self.assertEqual(len(self.vm.cmd('query-cpus-fast')), 2) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() diff --git a/tests/avocado/virtio_version.py b/tests/functional/test_virtio= _version.py old mode 100644 new mode 100755 similarity index 98% rename from tests/avocado/virtio_version.py rename to tests/functional/test_virtio_version.py index afe5e828b5..eb23060564 --- a/tests/avocado/virtio_version.py +++ b/tests/functional/test_virtio_version.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python3 """ Check compatibility of virtio device types """ @@ -12,7 +13,7 @@ import os =20 from qemu.machine import QEMUMachine -from avocado_qemu import QemuSystemTest +from qemu_test import QemuSystemTest =20 # Virtio Device IDs: VIRTIO_NET =3D 1 @@ -60,8 +61,6 @@ class VirtioVersionCheck(QemuSystemTest): Check if virtio-version-specific device types result in the same device tree created by `disable-modern` and `disable-legacy`. - - :avocado: tags=3Darch:x86_64 """ =20 # just in case there are failures, show larger diff: @@ -173,3 +172,6 @@ def test_modern_only_devs(self): self.check_modern_only('virtio-mouse-pci', VIRTIO_INPUT) self.check_modern_only('virtio-tablet-pci', VIRTIO_INPUT) self.check_modern_only('virtio-keyboard-pci', VIRTIO_INPUT) + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.46.0