From nobody Sun Nov 15 00:25:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) client-ip=38.145.34.151; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1794570377; cv=none; d=zohomail.com; s=zohoarc; b=Qzc0ru4WzSJYqlu0txIYx4i5OEfYOQl/xTIt3ydq9mhxHG8z68+yFFU75Xj0wWq/YCAilWg6aPQcTkwIJNiIECU0CxC/afNjqGHT53iRvx8yjeKDupeOJdBx+lXEuoMSHq7XhxeLZv/OflN/iTw5qIwAdmGdM3y5YraKGTPGeE8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794570377; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id:Cc; bh=HQugCxs+o/0ToorB0kCZc32EmGRKIxCFjjEPsnCcAMg=; b=dBrh4L1F76oXesXhXRnFBvEQMMxhl40WDe0z114SO56mWtmh6EN3EyAYn8gdrh3tm8XeU+mu/WsH/DI4e/rW4ylEph9tm63ykFHHYlbtiv+Zfgji6MTNrtBSIFss1QyEd9GLs66YeDOUwDaMgxLX3HbArFh7UdaGCiRBMfYUlz8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 38.145.34.151 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [38.145.34.151]) by mx.zohomail.com with SMTPS id 1794570377980848.9639499259072; Fri, 13 Nov 2026 03:46:17 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 75FC941B92; Fri, 13 Nov 2026 06:46:16 -0500 (EST) Received: from [172.19.199.25] (unknown [10.16.107.18]) by lists.libvirt.org (Postfix) with ESMTP id 3338041C20; Fri, 13 Nov 2026 06:45:17 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 3B94541B02; Fri, 13 Nov 2026 06:45:08 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 659103F875 for ; Fri, 13 Nov 2026 06:45:06 -0500 (EST) Received: from mx-prod-mc-03.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-253-cBBtKPkFO06sZb4-8TaH8A-1; Fri, 13 Nov 2026 06:45:04 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 86BB319773E9 for ; Fri, 13 Nov 2026 11:45:03 +0000 (UTC) Received: from jdenemar.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1A68F1955F2D for ; Fri, 13 Nov 2026 11:45:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS autolearn=no autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1794570306; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HQugCxs+o/0ToorB0kCZc32EmGRKIxCFjjEPsnCcAMg=; b=QXjh7K8UOIcm3dhBm05ufJsPeXErOjggQsyKh/0iz3ri6VNynBk07LG66b+ivcN4I+o19O YF02aXaEx5DnZbdV2QcRBYrQptbW70q1owcFslGZ3BCN4EWEmEfcH6aznBZssooW/CawkS 3Hs05nEF9Ya5WDA6CIgvS+ikFXBEHhk= X-MC-Unique: cBBtKPkFO06sZb4-8TaH8A-1 X-Mimecast-MFC-AGG-ID: cBBtKPkFO06sZb4-8TaH8A_1794570303 To: devel@lists.libvirt.org Subject: [PATCH] cputest: Add support for negative virCPUUpdateLive tests Date: Fri, 13 Nov 2026 12:45:00 +0100 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: UrtVT40ZscOde-XHaQUqZFVDIEei-Lbog9RVPI4vLEs_1794570303 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KQF7SJGOXSIZ2GT3MKPLSP5JDPLWZAVV X-Message-ID-Hash: KQF7SJGOXSIZ2GT3MKPLSP5JDPLWZAVV X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jiri Denemark via Devel Reply-To: Jiri Denemark X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1794570379629158500 Content-Type: text/plain; charset="utf-8" From: Jiri Denemark Signed-off-by: Jiri Denemark Reviewed-by: Michal Privoznik --- tests/cputest.c | 86 ++++++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 36 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index e29c81cb8e..c50d33dced 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -857,49 +857,63 @@ cpuTestUpdateLive(const void *arg) !(disabledData =3D virCPUDataParse(disabled))) return -1; =20 - expectedFile =3D g_strdup_printf("cpuid-%s-json", data->host); - if (!(expected =3D cpuTestLoadXML(data->arch, expectedFile, - data->existingTestCases))) { - return -1; - } - - /* In case the host CPU signature does not exactly match any CPU model= in - * src/cpu_map, the CPU model we detect from CPUID may differ from the= one - * we compute by asking QEMU. Since this test expands both CPU models = and - * compares their features, we can try to translate the 'actual' CPU to - * use the CPU model from 'expected'. - */ - if (STRNEQ(cpu->model, expected->model)) { - virDomainCapsCPUModel *hvModel; - char **blockers =3D NULL; - virDomainCapsCPUUsable usable =3D VIR_DOMCAPS_CPU_USABLE_UNKNOWN; - int rc; - - if (!(models =3D virDomainCapsCPUModelsNew(0))) + if (data->result =3D=3D 0) { + expectedFile =3D g_strdup_printf("cpuid-%s-json", data->host); + if (!(expected =3D cpuTestLoadXML(data->arch, expectedFile, + data->existingTestCases))) { return -1; - - rc =3D cpuTestGetCPUModels(data, &hvModels); - if (rc !=3D 0) - return rc; - - hvModel =3D virDomainCapsCPUModelsGet(hvModels, expected->model); - - if (hvModel) { - blockers =3D hvModel->blockers; - usable =3D hvModel->usable; } =20 - virDomainCapsCPUModelsAdd(models, expected->model, - usable, blockers, false, - expected->vendor, NULL); + /* In case the host CPU signature does not exactly match any CPU m= odel + * in src/cpu_map, the CPU model we detect from CPUID may differ f= rom + * the one we compute by asking QEMU. Since this test expands both= CPU + * models and compares their features, we can try to translate the + * 'actual' CPU to use the CPU model from 'expected'. + */ + if (STRNEQ(cpu->model, expected->model)) { + virDomainCapsCPUModel *hvModel; + char **blockers =3D NULL; + virDomainCapsCPUUsable usable =3D VIR_DOMCAPS_CPU_USABLE_UNKNO= WN; + int rc; =20 - cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; - ignore_value(virCPUTranslate(data->arch, cpu, models)); - cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; + if (!(models =3D virDomainCapsCPUModelsNew(0))) + return -1; + + rc =3D cpuTestGetCPUModels(data, &hvModels); + if (rc !=3D 0) + return rc; + + hvModel =3D virDomainCapsCPUModelsGet(hvModels, expected->mode= l); + + if (hvModel) { + blockers =3D hvModel->blockers; + usable =3D hvModel->usable; + } + + virDomainCapsCPUModelsAdd(models, expected->model, + usable, blockers, false, + expected->vendor, NULL); + + cpu->fallback =3D VIR_CPU_FALLBACK_ALLOW; + ignore_value(virCPUTranslate(data->arch, cpu, models)); + cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; + } } =20 - if (virCPUUpdateLive(data->arch, cpu, enabledData, disabledData) < 0) + if (virCPUUpdateLive(data->arch, cpu, enabledData, disabledData) < 0) { + if (data->result < 0) { + g_autofree char *msg =3D virTestLogContentAndReset(); + VIR_TEST_DEBUG("Got expected error: %s", msg); + virResetLastError(); + return 0; + } return -1; + } + + if (data->result !=3D 0) { + VIR_TEST_VERBOSE("virCPUUpdateLive was expected to fail"); + return -1; + } =20 return cpuTestUpdateLiveCompare(data->arch, cpu, expected); } --=20 2.56.0