From nobody Tue May 7 09:06:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152811983602726.345112884890796; Mon, 4 Jun 2018 06:43:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E374C9EC88; Mon, 4 Jun 2018 13:43:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 99AE160F8D; Mon, 4 Jun 2018 13:43:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 30CD91804480; Mon, 4 Jun 2018 13:43:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w54DhpUb000643 for ; Mon, 4 Jun 2018 09:43:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 97B9120357CB; Mon, 4 Jun 2018 13:43:51 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A68E20357CA for ; Mon, 4 Jun 2018 13:43:51 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 4 Jun 2018 15:43:38 +0200 Message-Id: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2] tests: qemuxml2argv: Make tests based on DO_TEST_CAPS_LATEST stable 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-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 04 Jun 2018 13:43:54 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" To avoid problems with test cases specifying an alias machine type which would change once capabilities for a newer version are added strip all alias machine types for the DO_TEST_CAPS_LATEST based tests. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- src/qemu/qemu_capabilities.c | 17 +++++++++++++= ++++ src/qemu/qemu_capspriv.h | 3 +++ .../disk-virtio-scsi-reservations.x86_64-latest.args | 2 +- tests/qemuxml2argvdata/genid-auto.x86_64-latest.args | 2 +- tests/qemuxml2argvdata/genid.x86_64-latest.args | 2 +- tests/qemuxml2argvtest.c | 8 +++++--- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b8764eacd8..a4a89cedfd 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5156,3 +5156,20 @@ virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCa= ps, { qemuCaps->microcodeVersion =3D microcodeVersion; } + + +/** + * virQEMUCapsStripMachineAliases: + * @qemuCaps: capabilities object to process + * + * Remove all aliases so that the tests depending on the latest capabiliti= es + * file can be stable when new files are added. + */ +void +virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps) +{ + size_t i; + + for (i =3D 0; i < qemuCaps->nmachineTypes; i++) + VIR_FREE(qemuCaps->machineTypes[i].alias); +} diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h index fea039ef3a..021260de2f 100644 --- a/src/qemu/qemu_capspriv.h +++ b/src/qemu/qemu_capspriv.h @@ -97,4 +97,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps, void virQEMUCapsSetMicrocodeVersion(virQEMUCapsPtr qemuCaps, unsigned int microcodeVersion); + +void +virQEMUCapsStripMachineAliases(virQEMUCapsPtr qemuCaps); #endif diff --git a/tests/qemuxml2argvdata/disk-virtio-scsi-reservations.x86_64-la= test.args b/tests/qemuxml2argvdata/disk-virtio-scsi-reservations.x86_64-lat= est.args index 768bc22f9f..927173fa03 100644 --- a/tests/qemuxml2argvdata/disk-virtio-scsi-reservations.x86_64-latest.ar= gs +++ b/tests/qemuxml2argvdata/disk-virtio-scsi-reservations.x86_64-latest.ar= gs @@ -13,7 +13,7 @@ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ path=3D/tmp/lib/domain--1-QEMUGuest1/pr-helper0.sock \ -object pr-manager-helper,id=3Dpr-helper-scsi0-0-0-1,\ path=3D/path/to/qemu-pr-helper.sock \ --machine pc-i440fx-2.12,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ -m 214 \ -realtime mlock=3Doff \ -smp 8,sockets=3D8,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2argvdata/genid-auto.x86_64-latest.args b/tests/q= emuxml2argvdata/genid-auto.x86_64-latest.args index ce163020b9..7412651479 100644 --- a/tests/qemuxml2argvdata/genid-auto.x86_64-latest.args +++ b/tests/qemuxml2argvdata/genid-auto.x86_64-latest.args @@ -9,7 +9,7 @@ QEMU_AUDIO_DRV=3Dnone \ -S \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-2.12,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ -m 214 \ -realtime mlock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2argvdata/genid.x86_64-latest.args b/tests/qemuxm= l2argvdata/genid.x86_64-latest.args index 54e00f4bdb..dbffa7e1d2 100644 --- a/tests/qemuxml2argvdata/genid.x86_64-latest.args +++ b/tests/qemuxml2argvdata/genid.x86_64-latest.args @@ -9,7 +9,7 @@ QEMU_AUDIO_DRV=3Dnone \ -S \ -object secret,id=3DmasterKey0,format=3Draw,\ file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ --machine pc-i440fx-2.12,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ -m 214 \ -realtime mlock=3Doff \ -smp 1,sockets=3D1,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 61c7ae59aa..693d623c17 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -695,7 +695,7 @@ mymain(void) * version. */ # define DO_TEST_CAPS_INTERNAL(name, suffix, migrateFrom, flags, parseFlag= s, \ - arch, capsfile) \ + arch, capsfile, stripmachinealiases) \ do { \ static struct testInfo info =3D { \ name, "." suffix, NULL, migrateFrom, migrateFrom ? 7 : -1,\ @@ -705,6 +705,8 @@ mymain(void) if (!(info.qemuCaps =3D qemuTestParseCapabilitiesArch(virArchFromS= tring(arch), \ capsfile))) \ return EXIT_FAILURE; \ + if (stripmachinealiases) \ + virQEMUCapsStripMachineAliases(info.qemuCaps); \ if (virTestRun("QEMU XML-2-ARGV " name "." suffix, \ testCompareXMLToArgv, &info) < 0) \ ret =3D -1; \ @@ -716,7 +718,7 @@ mymain(void) # define DO_TEST_CAPS_ARCH_VER_FULL(name, flags, parseFlags, arch, ver) \ DO_TEST_CAPS_INTERNAL(name, arch "-" ver, NULL, flags, parseFlags, \ - arch, TEST_CAPS_PATH ver "." arch ".xml") + arch, TEST_CAPS_PATH ver "." arch ".xml", false) # define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \ DO_TEST_CAPS_ARCH_VER_FULL(name, 0, 0, arch, ver) @@ -726,7 +728,7 @@ mymain(void) # define DO_TEST_CAPS_LATEST(name) \ DO_TEST_CAPS_INTERNAL(name, "x86_64-latest", NULL, 0, 0, "x86_64", \ - capslatest_x86_64) + capslatest_x86_64, true) /** * The following test macros should be used only in cases when the tests r= equire --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list