From nobody Thu Jan 23 06:00:52 2025 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=1737532985; cv=none; d=zohomail.com; s=zohoarc; b=TelgWBZMyjpL2C5gf24/2icZDsxPR2x8l/Ac73/IbTcg5IODl68OmlvwhhiKP7rRWyf6iTFmdPg5p5STzVjj0APLuDOZSADvvxajAS1gBMIkbD808csoQAzAVB+hnIgxX4OODKodWdmUVRAu4Xa8YStVtksP4whyFDNHc2XaaiU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737532985; 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=4O/4/WIa7B6lNUnZqppcqVButjrXOQoZJiap9Ak6YSI=; b=b8SJlBC+dLh6ZamV5ncg2+iGsOBLM783SEIRTaX4cwrNBuvV4K0tKxep9rFupb3gwLPF/jrpP+8rBm/E7H5TVN6bBFJFW2MN2Hl1DPqfluXqAMSouShlRmu1bLdgcqst9jWqnEv36RKYLrGWTvI8iyNN70f0zsDGrNfBjkWTbBA= 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 1737532985615409.6184756183187; Wed, 22 Jan 2025 00:03:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taVgb-0006nl-RK; Wed, 22 Jan 2025 03:02:05 -0500 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 1taVgZ-0006nU-PW for qemu-devel@nongnu.org; Wed, 22 Jan 2025 03:02:03 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taVgX-0004uu-Ll for qemu-devel@nongnu.org; Wed, 22 Jan 2025 03:02:03 -0500 Received: from mx-prod-mc-05.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-601-iRMs0l7fOduzJX5OJQOReQ-1; Wed, 22 Jan 2025 03:01:58 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BDE2E195608D; Wed, 22 Jan 2025 08:01:57 +0000 (UTC) Received: from thuth-p1g4.redhat.com (unknown [10.39.192.246]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4F3DE19560A7; Wed, 22 Jan 2025 08:01:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1737532921; 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=4O/4/WIa7B6lNUnZqppcqVButjrXOQoZJiap9Ak6YSI=; b=ghdRxAWerh4JjsikC5PrrOZYx+ONKnCqb09myabusxV8Xgy0yW15daMMacAu311JnIBo8O EdPt2D3AnCrpRsXRnONoKnSqL91sLY/pFfQOaDr7z6WrQFqsnmbtoms8WD7Fl48J2iaHwu SsuLMYGMu/Ypzu7tgUQ4ZInBWZEhJiU= X-MC-Unique: iRMs0l7fOduzJX5OJQOReQ-1 X-Mimecast-MFC-AGG-ID: iRMs0l7fOduzJX5OJQOReQ From: Thomas Huth To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , David Woodhouse Subject: [PULL v2 1/9] tests/functional: Convert the kvm_xen_guest avocado test Date: Wed, 22 Jan 2025 09:01:50 +0100 Message-ID: <20250122080151.1400422-2-thuth@redhat.com> In-Reply-To: <20250122080151.1400422-1-thuth@redhat.com> References: <20250122080151.1400422-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.12 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.129.124; envelope-from=thuth@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -50 X-Spam_score: -5.1 X-Spam_bar: ----- X-Spam_report: (-5.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.996, 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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: 1737532989000019000 Use the serial console to execute the commands in the guest instead of using ssh since we don't have ssh support in the functional framework yet. Acked-by: David Woodhouse Message-ID: <20250113082516.57894-1-thuth@redhat.com> Signed-off-by: Thomas Huth --- MAINTAINERS | 2 +- tests/functional/meson.build | 2 + .../test_x86_64_kvm_xen.py} | 89 +++++++++++-------- 3 files changed, 55 insertions(+), 38 deletions(-) rename tests/{avocado/kvm_xen_guest.py =3D> functional/test_x86_64_kvm_xen= .py} (61%) mode change 100644 =3D> 100755 diff --git a/MAINTAINERS b/MAINTAINERS index 846b81e3ec..94834b7876 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -489,7 +489,7 @@ S: Supported F: include/system/kvm_xen.h F: target/i386/kvm/xen* F: hw/i386/kvm/xen* -F: tests/avocado/kvm_xen_guest.py +F: tests/functional/test_x86_64_kvm_xen.py =20 Guest CPU Cores (other accelerators) ------------------------------------ diff --git a/tests/functional/meson.build b/tests/functional/meson.build index cf80924ddc..b7719ab85f 100644 --- a/tests/functional/meson.build +++ b/tests/functional/meson.build @@ -44,6 +44,7 @@ test_timeouts =3D { 'riscv64_tuxrun' : 120, 's390x_ccw_virtio' : 420, 'sh4_tuxrun' : 240, + 'x86_64_kvm_xen' : 180, } =20 tests_generic_system =3D [ @@ -244,6 +245,7 @@ tests_x86_64_system_thorough =3D [ 'netdev_ethtool', 'virtio_gpu', 'x86_64_hotplug_cpu', + 'x86_64_kvm_xen', 'x86_64_tuxrun', ] =20 diff --git a/tests/avocado/kvm_xen_guest.py b/tests/functional/test_x86_64_= kvm_xen.py old mode 100644 new mode 100755 similarity index 61% rename from tests/avocado/kvm_xen_guest.py rename to tests/functional/test_x86_64_kvm_xen.py index f8cb458d5d..0298c96c2e --- a/tests/avocado/kvm_xen_guest.py +++ b/tests/functional/test_x86_64_kvm_xen.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # KVM Xen guest functional tests # # Copyright =C2=A9 2021 Red Hat, Inc. @@ -13,19 +15,12 @@ =20 from qemu.machine import machine =20 -from avocado_qemu import LinuxSSHMixIn -from avocado_qemu import QemuSystemTest -from avocado_qemu import wait_for_console_pattern +from qemu_test import QemuSystemTest, Asset, exec_command_and_wait_for_pat= tern +from qemu_test import wait_for_console_pattern =20 -class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn): - """ - :avocado: tags=3Darch:x86_64 - :avocado: tags=3Dmachine:q35 - :avocado: tags=3Daccel:kvm - :avocado: tags=3Dkvm_xen_guest - """ +class KVMXenGuest(QemuSystemTest): =20 - KERNEL_DEFAULT =3D 'printk.time=3D0 root=3D/dev/xvda console=3DttyS0' + KERNEL_DEFAULT =3D 'printk.time=3D0 root=3D/dev/xvda console=3DttyS0 q= uiet' =20 kernel_path =3D None kernel_params =3D None @@ -33,14 +28,15 @@ class KVMXenGuest(QemuSystemTest, LinuxSSHMixIn): # Fetch assets from the kvm-xen-guest subdir of my shared test # images directory on fileserver.linaro.org where you can find # build instructions for how they where assembled. - def get_asset(self, name, sha1): - base_url =3D ('https://fileserver.linaro.org/s/' - 'kE4nCFLdQcoBF9t/download?' - 'path=3D%2Fkvm-xen-guest&files=3D' ) - url =3D base_url + name - # use explicit name rather than failing to neatly parse the - # URL into a unique one - return self.fetch_asset(name=3Dname, locations=3D(url), asset_hash= =3Dsha1) + ASSET_KERNEL =3D Asset( + ('https://fileserver.linaro.org/s/kE4nCFLdQcoBF9t/download?' + 'path=3D%2Fkvm-xen-guest&files=3DbzImage'), + 'ec0ad7bb8c33c5982baee0a75505fe7dbf29d3ff5d44258204d6307c6fe0132a') + + ASSET_ROOTFS =3D Asset( + ('https://fileserver.linaro.org/s/kE4nCFLdQcoBF9t/download?' + 'path=3D%2Fkvm-xen-guest&files=3Drootfs.ext4'), + 'b11045d649006c649c184e93339aaa41a8fe20a1a86620af70323252eb29e40b') =20 def common_vm_setup(self): # We also catch lack of KVM_XEN support if we fail to launch @@ -51,10 +47,8 @@ def common_vm_setup(self): self.vm.add_args("-accel", "kvm,xen-version=3D0x4000a,kernel-irqch= ip=3Dsplit") self.vm.add_args("-smp", "2") =20 - self.kernel_path =3D self.get_asset("bzImage", - "367962983d0d32109998a70b45dcee4= 672d0b045") - self.rootfs =3D self.get_asset("rootfs.ext4", - "f1478401ea4b3fa2ea196396be44315bab2b= b5e4") + self.kernel_path =3D self.ASSET_KERNEL.fetch() + self.rootfs =3D self.ASSET_ROOTFS.fetch() =20 def run_and_check(self): self.vm.add_args('-kernel', self.kernel_path, @@ -68,10 +62,10 @@ def run_and_check(self): self.vm.launch() except machine.VMLaunchFailure as e: if "Xen HVM guest support not present" in e.output: - self.cancel("KVM Xen support is not present " - "(need v5.12+ kernel with CONFIG_KVM_XEN)") + self.skipTest("KVM Xen support is not present " + "(need v5.12+ kernel with CONFIG_KVM_XEN)") elif "Property 'kvm-accel.xen-version' not found" in e.output: - self.cancel("QEMU not built with CONFIG_XEN_EMU support") + self.skipTest("QEMU not built with CONFIG_XEN_EMU support") else: raise e =20 @@ -79,10 +73,11 @@ def run_and_check(self): console_pattern =3D 'Starting dropbear sshd: OK' wait_for_console_pattern(self, console_pattern, 'Oops') self.log.info('sshd ready') - self.ssh_connect('root', '', False) =20 - self.ssh_command('cat /proc/cmdline') - self.ssh_command('dmesg | grep -e "Grant table initialized"') + exec_command_and_wait_for_pattern(self, 'cat /proc/cmdline', 'xen') + exec_command_and_wait_for_pattern(self, 'dmesg | grep "Grant table= "', + 'Grant table initialized') + wait_for_console_pattern(self, '#', 'Oops') =20 def test_kvm_xen_guest(self): """ @@ -94,7 +89,9 @@ def test_kvm_xen_guest(self): self.kernel_params =3D (self.KERNEL_DEFAULT + ' xen_emul_unplug=3Dide-disks') self.run_and_check() - self.ssh_command('grep xen-pirq.*msi /proc/interrupts') + exec_command_and_wait_for_pattern(self, + 'grep xen-pirq.*msi /proc/interrupts', + 'virtio0-output') =20 def test_kvm_xen_guest_nomsi(self): """ @@ -106,7 +103,9 @@ def test_kvm_xen_guest_nomsi(self): self.kernel_params =3D (self.KERNEL_DEFAULT + ' xen_emul_unplug=3Dide-disks pci=3Dnomsi') self.run_and_check() - self.ssh_command('grep xen-pirq.* /proc/interrupts') + exec_command_and_wait_for_pattern(self, + 'grep xen-pirq.* /proc/interrupts', + 'virtio0') =20 def test_kvm_xen_guest_noapic_nomsi(self): """ @@ -118,7 +117,9 @@ def test_kvm_xen_guest_noapic_nomsi(self): self.kernel_params =3D (self.KERNEL_DEFAULT + ' xen_emul_unplug=3Dide-disks noapic pci=3Dn= omsi') self.run_and_check() - self.ssh_command('grep xen-pirq /proc/interrupts') + exec_command_and_wait_for_pattern(self, + 'grep xen-pirq /proc/interrupts', + 'virtio0') =20 def test_kvm_xen_guest_vapic(self): """ @@ -130,8 +131,13 @@ def test_kvm_xen_guest_vapic(self): self.kernel_params =3D (self.KERNEL_DEFAULT + ' xen_emul_unplug=3Dide-disks') self.run_and_check() - self.ssh_command('grep xen-pirq /proc/interrupts') - self.ssh_command('grep PCI-MSI /proc/interrupts') + exec_command_and_wait_for_pattern(self, + 'grep xen-pirq /proc/interrupts', + 'acpi') + wait_for_console_pattern(self, '#') + exec_command_and_wait_for_pattern(self, + 'grep PCI-MSI /proc/interrupts', + 'virtio0-output') =20 def test_kvm_xen_guest_novector(self): """ @@ -143,7 +149,9 @@ def test_kvm_xen_guest_novector(self): ' xen_emul_unplug=3Dide-disks' + ' xen_no_vector_callback') self.run_and_check() - self.ssh_command('grep xen-platform-pci /proc/interrupts') + exec_command_and_wait_for_pattern(self, + 'grep xen-platform-pci /proc/interrupts', + 'fasteoi') =20 def test_kvm_xen_guest_novector_nomsi(self): """ @@ -156,7 +164,9 @@ def test_kvm_xen_guest_novector_nomsi(self): ' xen_emul_unplug=3Dide-disks pci=3Dnomsi' + ' xen_no_vector_callback') self.run_and_check() - self.ssh_command('grep xen-platform-pci /proc/interrupts') + exec_command_and_wait_for_pattern(self, + 'grep xen-platform-pci /proc/interrupts', + 'IO-APIC') =20 def test_kvm_xen_guest_novector_noapic(self): """ @@ -168,4 +178,9 @@ def test_kvm_xen_guest_novector_noapic(self): ' xen_emul_unplug=3Dide-disks' + ' xen_no_vector_callback noapic') self.run_and_check() - self.ssh_command('grep xen-platform-pci /proc/interrupts') + exec_command_and_wait_for_pattern(self, + 'grep xen-platform-pci /proc/interrupts', + 'XT-PIC') + +if __name__ =3D=3D '__main__': + QemuSystemTest.main() --=20 2.48.1