From nobody Thu Dec 18 09:19:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1487154480687646.4824589775152; Wed, 15 Feb 2017 02:28:00 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1FAHRRH035394; Wed, 15 Feb 2017 05:17:27 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1FAFZ5T003246 for ; Wed, 15 Feb 2017 05:15:35 -0500 Received: from virval.usersys.redhat.com (dhcp129-92.brq.redhat.com [10.34.129.92]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1FAFYS0009818 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 15 Feb 2017 05:15:35 -0500 Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 9AA42105DDE; Wed, 15 Feb 2017 11:15:29 +0100 (CET) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 15 Feb 2017 11:15:24 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 30/33] cputest: Test virQEMUCapsInitCPUModel X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The original test didn't use family/model numbers to make better decisions about the CPU model and thus mis-detected the model in the two cases which are modified in this commit. The detected CPU models now match those obtained from raw CPUID data. Signed-off-by: Jiri Denemark --- tests/cputest.c | 28 +++++++++++++++---= ---- .../x86_64-cpuid-Core-i7-5600U-json.xml | 11 +++++---- .../cputestdata/x86_64-cpuid-Core2-E6850-json.xml | 4 ++-- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/tests/cputest.c b/tests/cputest.c index c0a816b60..8c16fb95c 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -43,7 +43,9 @@ #if WITH_QEMU && WITH_YAJL # include "testutilsqemu.h" # include "qemumonitortestutils.h" -# include "qemu/qemu_monitor_json.h" +# define __QEMU_CAPSRIV_H_ALLOW__ +# include "qemu/qemu_capspriv.h" +# undef __QEMU_CAPSRIV_H_ALLOW__ #endif =20 #define VIR_FROM_THIS VIR_FROM_CPU @@ -517,14 +519,15 @@ static int cpuTestJSONCPUID(const void *arg) { const struct data *data =3D arg; - virCPUDataPtr cpuData =3D NULL; + qemuMonitorCPUModelInfoPtr model =3D NULL; + virQEMUCapsPtr qemuCaps =3D NULL; virCPUDefPtr cpu =3D NULL; qemuMonitorTestPtr testMon =3D NULL; char *json =3D NULL; char *result =3D NULL; int ret =3D -1; =20 - if (virAsprintf(&json, "%s/cputestdata/%s-cpuid-%s.json", + if (virAsprintf(&json, "%s/cputestdata/%s-cpuid-%s.json.new", abs_srcdir, virArchToString(data->arch), data->host) <= 0 || virAsprintf(&result, "cpuid-%s-json", data->host) < 0) goto cleanup; @@ -532,26 +535,35 @@ cpuTestJSONCPUID(const void *arg) if (!(testMon =3D qemuMonitorTestNewFromFile(json, driver.xmlopt, true= ))) goto cleanup; =20 - if (qemuMonitorJSONGetCPUx86Data(qemuMonitorTestGetMonitor(testMon), - "feature-words", &cpuData) < 0) + if (qemuMonitorGetCPUModelExpansion(qemuMonitorTestGetMonitor(testMon), + QEMU_MONITOR_CPU_MODEL_EXPANSION_S= TATIC, + "host", &model) < 0) goto cleanup; =20 + if (!(qemuCaps =3D virQEMUCapsNew())) + goto cleanup; + + virQEMUCapsSetArch(qemuCaps, data->arch); + virQEMUCapsSetCPUModelInfo(qemuCaps, VIR_DOMAIN_VIRT_KVM, model); + model =3D NULL; + if (VIR_ALLOC(cpu) < 0) goto cleanup; =20 - cpu->arch =3D cpuData->arch; + cpu->arch =3D data->arch; cpu->type =3D VIR_CPU_TYPE_GUEST; cpu->match =3D VIR_CPU_MATCH_EXACT; cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; =20 - if (cpuDecode(cpu, cpuData, NULL, 0, NULL) < 0) + if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu) !=3D 0) goto cleanup; =20 ret =3D cpuTestCompareXML(data->arch, cpu, result, false); =20 cleanup: + qemuMonitorCPUModelInfoFree(model); + virObjectUnref(qemuCaps); qemuMonitorTestFree(testMon); - virCPUDataFree(cpuData); virCPUDefFree(cpu); VIR_FREE(result); VIR_FREE(json); diff --git a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-json.xml b/tests/= cputestdata/x86_64-cpuid-Core-i7-5600U-json.xml index 159797178..8a6b8283f 100644 --- a/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-json.xml +++ b/tests/cputestdata/x86_64-cpuid-Core-i7-5600U-json.xml @@ -1,12 +1,15 @@ x86_64 - Skylake-Client + Broadwell + + + + + - - - + diff --git a/tests/cputestdata/x86_64-cpuid-Core2-E6850-json.xml b/tests/cp= utestdata/x86_64-cpuid-Core2-E6850-json.xml index ddd730735..e93e0a321 100644 --- a/tests/cputestdata/x86_64-cpuid-Core2-E6850-json.xml +++ b/tests/cputestdata/x86_64-cpuid-Core2-E6850-json.xml @@ -1,11 +1,11 @@ x86_64 - Penryn + Conroe + - --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list